/* SC2 Match Tracker — dashboard styles */

:root {
  --bg: #0b1120;
  --bg-deep: #070c17;
  --panel: #111a2e;
  --panel-2: #172239;
  --line: #243352;
  --line-soft: #1b2740;
  --text: #e6edf7;
  --muted: #8ea0c0;
  --accent: #45d5ff;
  --accent-dim: rgba(69, 213, 255, 0.16);
  --win: #35d07f;
  --win-dim: rgba(53, 208, 127, 0.12);
  --loss: #ff5a6e;
  --loss-dim: rgba(255, 90, 110, 0.12);
  --warn: #ffb84d;
  --display: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --radius: 6px;
  --gutter: 20px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(69, 213, 255, 0.08), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23, 34, 57, 0.9), rgba(11, 17, 32, 0.9));
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 14px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 18px rgba(69, 213, 255, 0.35);
}
.brand-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em;
  color: var(--muted); white-space: nowrap;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live[data-state="live"] { color: var(--win); border-color: rgba(53, 208, 127, 0.4); }
.live[data-state="live"] .live-dot { background: var(--win); box-shadow: 0 0 10px var(--win); }
.live[data-state="polling"] { color: var(--accent); }
.live[data-state="polling"] .live-dot { background: var(--accent); }
.live[data-state="offline"] { color: var(--warn); border-color: rgba(255, 184, 77, 0.4); }
.live[data-state="offline"] .live-dot { background: var(--warn); }

.banner {
  background: rgba(255, 184, 77, 0.12); border-bottom: 1px solid rgba(255, 184, 77, 0.4);
  color: var(--warn); padding: 10px var(--gutter); text-align: center; font-weight: 500;
}
.banner-detail { color: var(--muted); font-size: 13px; margin-left: 8px; }

/* Page */
.page { max-width: 1400px; margin: 0 auto; padding: 22px var(--gutter) 40px; }

/* Player selector */
.player-select { margin-bottom: 18px; }
.player-label {
  display: block; font-family: var(--display); font-weight: 600; font-size: 13px;
  letter-spacing: 0.18em; color: var(--accent); margin-bottom: 6px;
}
.player-row { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.player-dropdown {
  appearance: none; -webkit-appearance: none;
  background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='10'><path d='M1 1l6 6 6-6' fill='none' stroke='%2345d5ff' stroke-width='2'/></svg>") no-repeat right 4px center;
  border: 0; border-bottom: 2px solid var(--line);
  color: var(--text); font-family: var(--display); font-weight: 700; font-size: 38px; line-height: 1.1;
  padding: 0 30px 4px 0; cursor: pointer; max-width: 100%;
}
.player-dropdown:hover { border-bottom-color: var(--accent); }
.player-dropdown option { background: var(--panel); color: var(--text); font-size: 16px; }
.player-meta { color: var(--muted); font-size: 14px; }

/* Stat strip: one band, dividers carry the structure */
.stat-strip {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  overflow: hidden;
}
.stat { padding: 16px 18px; border-left: 1px solid var(--line-soft); }
.stat:first-child { border-left: 0; }
.stat-label { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.16em; color: var(--muted); }
.stat-value { font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value.win { color: var(--win); }
.stat-value.loss { color: var(--loss); }
.stat-value .unit { font-size: 18px; color: var(--muted); margin-left: 2px; }

.detail-strip {
  display: grid; grid-template-columns: repeat(9, auto); gap: 6px 22px;
  padding: 10px 4px 0; margin-bottom: 18px; overflow-x: auto;
}
.detail { display: flex; flex-direction: column; white-space: nowrap; }
.detail-k { color: var(--muted); font-size: 12px; }
.detail-v { font-family: var(--display); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.detail-v .w { color: var(--win); }
.detail-v .l { color: var(--loss); }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center;
  padding: 12px 14px; margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-custom label { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.filter-custom input {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 4px; color: var(--text);
  font: inherit; font-size: 13px; padding: 5px 8px; color-scheme: dark;
}
.chip {
  background: transparent; border: 1px solid var(--line); border-radius: 4px;
  padding: 5px 11px; font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.06em;
  color: var(--muted); cursor: pointer; transition: background 120ms, color 120ms, border-color 120ms;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.is-active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.chip-win.is-active { background: var(--win-dim); border-color: var(--win); color: var(--win); }
.chip-loss.is-active { background: var(--loss-dim); border-color: var(--loss); color: var(--loss); }
.chip-apply { color: var(--text); }

/* Panels */
.panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px 6px;
}
.panel-title { margin: 0; font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: 0.04em; }
.panel-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.zoom-group { display: flex; gap: 4px; }
.chart { width: 100%; }
.chart-main { height: 460px; }
.chart-secondary { height: 300px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel-grid .panel { margin-bottom: 18px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* Crosshair panel (ECharts tooltip content) */
.xh { font-family: var(--body); font-size: 13px; min-width: 210px; color: var(--text); }
.xh-head { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.xh-head.win { color: var(--win); }
.xh-head.loss { color: var(--loss); }
.xh-row { display: flex; justify-content: space-between; gap: 16px; line-height: 1.55; }
.xh-row span:first-child { color: var(--muted); }
.xh-row b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Table */
.table-wrap { overflow-x: auto; }
.matches { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.matches th {
  text-align: left; font-family: var(--display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.12em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.matches td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.matches tr.win td:first-child { box-shadow: inset 3px 0 0 var(--win); }
.matches tr.loss td:first-child { box-shadow: inset 3px 0 0 var(--loss); }
.matches tr.win { background: var(--win-dim); }
.matches tr.loss { background: var(--loss-dim); }
.matches tr:hover td { background: rgba(255, 255, 255, 0.03); }
.result-tag { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; }
.result-tag.win { color: var(--win); }
.result-tag.loss { color: var(--loss); }
.td-muted { color: var(--muted); }
.table-foot { padding: 12px 14px; }

.foot { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; padding-top: 6px; }
.foot-link { color: var(--muted); }

/* Admin page */
.admin { max-width: 960px; margin: 0 auto; padding: 24px var(--gutter) 40px; }
.admin h1 { font-family: var(--display); letter-spacing: 0.1em; font-size: 24px; margin: 0 0 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.admin-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; }
.admin-card .k { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; font-family: var(--display); }
.admin-card .v { font-family: var(--display); font-size: 20px; font-weight: 600; margin-top: 2px; word-break: break-word; }
.admin-card .v.ok { color: var(--win); }
.admin-card .v.bad { color: var(--loss); }
.admin-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.btn {
  background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 4px; padding: 8px 16px; font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.login { max-width: 360px; margin: 80px auto; }
.login input[type=password] { width: 100%; padding: 10px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font: inherit; margin: 8px 0 12px; }
.error-box { border: 1px solid rgba(255, 90, 110, 0.5); background: var(--loss-dim); color: var(--loss); padding: 10px 12px; border-radius: 4px; margin-bottom: 14px; }
.runs { width: 100%; border-collapse: collapse; font-size: 13px; }
.runs th, .runs td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.runs th { color: var(--muted); font-family: var(--display); letter-spacing: 0.1em; font-weight: 600; }
.runs td.err { white-space: normal; color: var(--loss); }
.runs .ok { color: var(--win); } .runs .error { color: var(--loss); } .runs .running { color: var(--warn); }

/* Responsive */
@media (max-width: 1100px) {
  .panel-grid { grid-template-columns: 1fr; }
  .detail-strip { grid-template-columns: repeat(5, auto); }
}
@media (max-width: 760px) {
  :root { --gutter: 12px; }
  .brand-title { font-size: 20px; }
  .brand-sub { display: none; }
  .player-dropdown { font-size: 28px; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .stat { padding: 12px 12px; }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(4), .stat:nth-child(5) { border-top: 1px solid var(--line-soft); }
  .stat-value { font-size: 28px; }
  .detail-strip { grid-template-columns: repeat(3, auto); }
  .chart-main { height: 360px; }
  .chart-secondary { height: 260px; }
  .filters { gap: 8px 14px; }
  .filter-custom { width: 100%; }
  .filter-custom label { flex: 1 1 140px; }
  .filter-custom input { width: 100%; }
  .matches th, .matches td { padding: 8px 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .chip { transition: none; }
}

/* Admin settings form */
.admin details.admin-card > summary { list-style: revert; }
.admin form label { display: block; font-size: 13px; color: var(--muted); margin: 0; }
.admin form label input, .admin form label select, .admin form label textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: #070c17; border: 1px solid var(--line); border-radius: 5px;
  color: var(--text); font: inherit; color-scheme: dark;
}
.admin form label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.admin form label.check input { width: auto; margin-top: 0; }
.admin form textarea { resize: vertical; font-family: inherit; }

/* Leaderboard (index) */
.lb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.lb-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: .14em; line-height: 1; color: var(--text); text-shadow: 0 0 18px rgba(69,213,255,.25); }
.lb-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.lb-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lb-search { padding: 7px 11px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 5px; color: var(--text); font: inherit; font-size: 14px; min-width: 200px; color-scheme: dark; }
.lb-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.lb-min { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.lb-min input { width: 64px; padding: 6px 8px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 4px; color: var(--text); font: inherit; color-scheme: dark; }

.leaderboard .col-rank { width: 44px; text-align: right; font-family: var(--display); font-weight: 700; color: var(--muted); }
.leaderboard td.col-rank.rank-1 { color: #ffd166; text-shadow: 0 0 10px rgba(255,209,102,.5); }
.leaderboard td.col-rank.rank-2 { color: #cfd8e3; }
.leaderboard td.col-rank.rank-3 { color: #d9a066; }
.leaderboard .lb-row { cursor: pointer; }
.leaderboard .lb-row:hover td { background: rgba(69,213,255,.06); }
.leaderboard .lb-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.leaderboard .lb-name a { color: var(--text); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .02em; }
.leaderboard .lb-name a:hover { color: var(--accent); }
.leaderboard td.win { color: var(--win); font-weight: 600; }
.leaderboard td.loss { color: var(--loss); font-weight: 600; }
.lb-wr { display: inline-block; min-width: 54px; font-variant-numeric: tabular-nums; font-weight: 600; }
.lb-bar { display: inline-block; vertical-align: middle; width: 90px; height: 6px; margin-left: 8px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.lb-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--loss), var(--win)); border-radius: 3px; }
.back-link { color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .lb-title { font-size: 26px; }
  .lb-controls { width: 100%; }
  .lb-search { flex: 1 1 100%; min-width: 0; }
  .lb-bar { width: 50px; }
}
/* Keep the back-to-players link visible on mobile even though the rest of brand-sub hides */
@media (max-width: 760px) {
  .brand-sub { display: block; font-size: 12px; }
  .brand-sub { color: transparent; }
  .brand-sub .back-link { color: var(--accent); }
}

/* ---- loading state (player page) ---- */
.panel { position: relative; }
.chart-loader {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(11, 17, 32, 0.78); backdrop-filter: blur(2px); border-radius: inherit;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.chart-loader.is-on { opacity: 1; pointer-events: auto; }
.loader-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: loader-spin 0.85s linear infinite;
  box-shadow: 0 0 18px var(--accent-dim);
}
.loader-ring-sm { width: 26px; height: 26px; border-width: 2px; }
.loader-msg {
  font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); min-height: 1.3em;
}
.loader-msg.swap { animation: loader-fade 0.35s ease; }
.page.is-loading .stat-value,
.page.is-loading .detail-v { color: var(--muted); animation: loader-pulse 1.1s ease-in-out infinite; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes loader-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) {
  .loader-ring { animation-duration: 2s; }
  .page.is-loading .stat-value, .page.is-loading .detail-v { animation: none; opacity: 0.5; }
}

/* ---- "Recent matches" rows on the index ---- */
/* "Recent matches" rows are not tinted by result: the WIN/LOSS tag carries the result.
   Only awarded rows (gold / cold / trend) get a row effect (those rules come later and win). */
.leaderboard tr.win, .leaderboard tr.loss { background: transparent; }
.leaderboard tr.win td:first-child, .leaderboard tr.loss td:first-child { box-shadow: none; }
.leaderboard .lb-name .result-tag { font-size: 12px; margin-left: 8px; }
.leaderboard .feed-ago { color: var(--muted); font-size: 12px; margin-left: 6px; }
.leaderboard tr.is-new td { animation: feed-flash 1.6s ease-out; }
.feed-foot { padding: 10px 14px; text-align: center; }
@keyframes feed-flash { from { background: var(--accent-dim); } to { background: transparent; } }

/* =====================================================================
   Index awards: medal cards (ember), cold (snow), trend up/down (stock glow)
   All effects are painted on the <tr> (background + glow) or on one overlay
   that spans the whole row, so there are no per-cell seams.
   ===================================================================== */

/* --- badges after the username --- */
.award-set { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; vertical-align: middle; }
.award { display: inline-flex; align-items: center; gap: 4px; cursor: help; border-radius: 4px; }
.award:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.award-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--muted);
  color: var(--muted); font: 700 9px/1 var(--body); font-style: italic; opacity: .7;
}
.award:hover .award-info, .award:focus-visible .award-info { color: var(--text); border-color: var(--text); opacity: 1; }

/* word cards: GOLD / SILVER / BRONZE / COLD */
.award-card {
  display: inline-block; padding: 2px 8px 1px; border: 1px solid; border-radius: 4px;
  font-family: var(--display); font-weight: 700; font-size: 11.5px; letter-spacing: .16em; line-height: 1.3;
  background: rgba(0, 0, 0, .28); text-shadow: 0 0 6px currentColor;
}
.award-card.gold   { color: #ffd166; border-color: #ffd166; box-shadow: 0 0 8px rgba(255, 209, 102, .55), inset 0 0 8px rgba(255, 209, 102, .18); }
.award-card.silver { color: #e2e8f0; border-color: #cfd8e3; box-shadow: 0 0 8px rgba(207, 216, 227, .45), inset 0 0 8px rgba(207, 216, 227, .15); }
.award-card.bronze { color: #e6b07a; border-color: #d9a066; box-shadow: 0 0 8px rgba(217, 160, 102, .5), inset 0 0 8px rgba(217, 160, 102, .16); }
.award-card.cold   { color: #bfe6ff; border-color: #7cc8ff; box-shadow: 0 0 8px rgba(124, 200, 255, .55), inset 0 0 8px rgba(124, 200, 255, .18); }

.award-icon { width: 20px; height: 20px; display: block; }
.award-icon.trend { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.award-icon.trend.up   { stroke: var(--win);  filter: drop-shadow(0 0 4px rgba(53, 208, 127, .9)); }
.award-icon.trend.down { stroke: var(--loss); filter: drop-shadow(0 0 4px rgba(255, 90, 110, .9)); }

/* --- quick-chart peek button (left of the username) --- */
.peek {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 22px; margin-right: 8px; vertical-align: middle; padding: 0;
  background: rgba(69, 213, 255, .08); border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.peek:hover, .peek:focus-visible { border-color: var(--accent); background: var(--accent-dim); }
.peek-icon { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- floating boxes: award tooltip and chart peek --- */
#awardTip, #chartPeek {
  position: fixed; z-index: 60; background: #0d1527; border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease;
}
#awardTip.is-on, #chartPeek.is-on { opacity: 1; transform: none; }
#awardTip { max-width: 340px; padding: 9px 11px; font-size: 12.5px; line-height: 1.45; pointer-events: none; }
#awardTip b { display: block; font-family: var(--display); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; margin-bottom: 3px; }
#awardTip[data-kind="gold"]   { border-color: rgba(255, 209, 102, .6); } #awardTip[data-kind="gold"] b   { color: #ffd166; }
#awardTip[data-kind="silver"] { border-color: rgba(215, 223, 234, .6); } #awardTip[data-kind="silver"] b { color: #d7dfea; }
#awardTip[data-kind="bronze"] { border-color: rgba(217, 160, 102, .6); } #awardTip[data-kind="bronze"] b { color: #d9a066; }
#awardTip[data-kind="cold"]   { border-color: rgba(120, 200, 255, .6); } #awardTip[data-kind="cold"] b   { color: #9fd8ff; }
#awardTip[data-kind="up"]     { border-color: rgba(53, 208, 127, .6); }  #awardTip[data-kind="up"] b     { color: var(--win); }
#awardTip[data-kind="down"]   { border-color: rgba(255, 90, 110, .6); }  #awardTip[data-kind="down"] b   { color: var(--loss); }

#chartPeek { width: 324px; padding: 10px 12px 12px; border-color: rgba(69, 213, 255, .45); }
.peek-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.peek-head b { font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .04em; }
.peek-head .td-muted { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.peek-chart { display: block; width: 100%; height: auto; }
.peek-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.peek-stats b { color: var(--text); font-weight: 600; margin-left: 3px; }
.peek-stats b.win { color: var(--win); } .peek-stats b.loss { color: var(--loss); }
.peek-empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; }
.peek-link { display: block; margin-top: 8px; font-size: 12.5px; text-decoration: none; }
.peek-link:hover { text-decoration: underline; }

/* --- LIVE badge (top bar) --- */
.live-badge { gap: 8px; padding: 7px 14px 7px 12px; }
.live-badge .live-text { font-weight: 700; letter-spacing: .18em; }
.live-badge .live-sub { font-family: var(--body); font-weight: 500; font-size: 12px; letter-spacing: .02em; text-transform: lowercase; color: var(--muted); }
.live-badge .live-dot { position: relative; width: 9px; height: 9px; }
.live-badge .live-dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid currentColor; opacity: 0;
  animation: live-ping 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
.live-badge[data-state="live"] { color: #ff3b5c; border-color: rgba(255, 59, 92, .55); background: rgba(255, 59, 92, .08); }
.live-badge[data-state="live"] .live-dot { background: #ff3b5c; box-shadow: 0 0 10px #ff3b5c, 0 0 20px rgba(255, 59, 92, .6); animation: live-blink 1.6s ease-in-out infinite; }
.live-badge[data-state="offline"] { color: var(--warn); border-color: rgba(255, 184, 77, .45); }
.live-badge[data-state="offline"] .live-dot { background: var(--warn); }
.live-badge[data-state="offline"] .live-dot::after { animation: none; }
@keyframes live-ping  { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes live-blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* --- daily countdown banner (below the top bar) --- */
.countdown-banner {
  position: relative; overflow: hidden; text-align: center;
  margin: 0 0 4px; padding: 18px 16px 16px;
  background:
    radial-gradient(ellipse at center, rgba(255, 140, 40, .22), rgba(255, 120, 30, 0) 62%),
    linear-gradient(180deg, rgba(255, 120, 30, .06), rgba(0, 0, 0, 0));
  border-bottom: 1px solid rgba(255, 140, 40, .28);
}
.countdown-banner::before, .countdown-banner::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%); height: 1px; width: min(720px, 90%);
  background: linear-gradient(90deg, transparent, rgba(255, 184, 77, .9), transparent);
}
.countdown-banner::before { top: 0; } .countdown-banner::after { bottom: -1px; }
.cd-label { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: .32em; color: var(--warn); text-shadow: 0 0 12px rgba(255, 184, 77, .5); }
.cd-clock { display: inline-flex; align-items: baseline; justify-content: center; margin: 4px 0 2px; }
.cd-main {
  font-family: var(--display); font-weight: 700; font-size: clamp(44px, 8vw, 84px); line-height: 1; letter-spacing: .06em;
  font-variant-numeric: tabular-nums; color: #fff4e0;
  text-shadow: 0 0 10px rgba(255, 184, 77, .9), 0 0 28px rgba(255, 120, 30, .7), 0 0 60px rgba(255, 90, 20, .45);
  animation: cd-breathe 2.4s ease-in-out infinite;
}
.cd-ms {
  font-family: var(--display); font-weight: 600; font-size: clamp(20px, 3vw, 34px); letter-spacing: .06em; margin-left: 2px;
  font-variant-numeric: tabular-nums; color: #ffb86b; text-shadow: 0 0 10px rgba(255, 140, 40, .8); min-width: 3.2ch; text-align: left;
}
.cd-foot { font-family: var(--display); font-weight: 600; font-size: 11.5px; letter-spacing: .2em; color: var(--muted); }
.cd-date { color: var(--text); }
@keyframes cd-breathe {
  0%, 100% { text-shadow: 0 0 10px rgba(255, 184, 77, .9), 0 0 28px rgba(255, 120, 30, .7), 0 0 60px rgba(255, 90, 20, .45); }
  50%      { text-shadow: 0 0 14px rgba(255, 184, 77, 1), 0 0 40px rgba(255, 120, 30, .9), 0 0 90px rgba(255, 90, 20, .7); }
}
/* final hour: red; final 10 minutes: flashing */
.countdown-banner[data-urgent="1"], .countdown-banner[data-urgent="2"] {
  border-bottom-color: rgba(255, 90, 110, .5);
  background: radial-gradient(ellipse at center, rgba(255, 60, 90, .26), rgba(255, 60, 90, 0) 62%), linear-gradient(180deg, rgba(255, 60, 90, .08), rgba(0, 0, 0, 0));
}
.countdown-banner[data-urgent="1"] .cd-label, .countdown-banner[data-urgent="2"] .cd-label { color: var(--loss); text-shadow: 0 0 12px rgba(255, 90, 110, .6); }
.countdown-banner[data-urgent="1"] .cd-main, .countdown-banner[data-urgent="2"] .cd-main {
  color: #ffe4e8; animation: cd-red 1.2s ease-in-out infinite;
}
.countdown-banner[data-urgent="1"] .cd-ms, .countdown-banner[data-urgent="2"] .cd-ms { color: #ff8a9a; text-shadow: 0 0 10px rgba(255, 90, 110, .8); }
.countdown-banner[data-urgent="2"] .cd-clock { animation: cd-flash .5s steps(2) infinite; }
@keyframes cd-red {
  0%, 100% { text-shadow: 0 0 10px rgba(255, 90, 110, .9), 0 0 30px rgba(255, 60, 90, .8), 0 0 70px rgba(255, 30, 60, .5); }
  50%      { text-shadow: 0 0 16px rgba(255, 90, 110, 1), 0 0 50px rgba(255, 60, 90, 1), 0 0 110px rgba(255, 30, 60, .8); }
}
@keyframes cd-flash { 50% { opacity: .35; } }
.panel-sub .countdown-value { font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--warn); font-variant-numeric: tabular-nums; }

/* --- pinned tables (podium + all-time highs) --- */
.pinned { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.pin-panel { margin-bottom: 0; }
.pin-podium { border-color: rgba(255, 140, 40, .45); box-shadow: 0 0 0 1px rgba(255, 140, 40, .08), 0 0 28px -8px rgba(255, 120, 30, .35); }
.pin-highs  { border-color: rgba(53, 208, 127, .45); box-shadow: 0 0 0 1px rgba(53, 208, 127, .08), 0 0 28px -8px rgba(53, 208, 127, .35); }
.pin-cold   { border-color: rgba(124, 200, 255, .45); box-shadow: 0 0 0 1px rgba(124, 200, 255, .08), 0 0 28px -8px rgba(124, 200, 255, .35); }
.pin-cold .panel-title   { color: #9fd8ff; text-shadow: 0 0 12px rgba(124, 200, 255, .45); }
.pin-podium .panel-title { color: #ffd166; text-shadow: 0 0 12px rgba(255, 209, 102, .45); }
.pin-highs .panel-title  { color: var(--win); text-shadow: 0 0 12px rgba(53, 208, 127, .45); }
.pin-panel .panel-head { padding-bottom: 8px; }
.pin-table th { font-size: 11px; padding-left: 8px; padding-right: 8px; }
.pin-table td { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.pin-table .col-medal { width: 1%; padding-right: 4px; }
.pin-table .col-rank { width: 1%; }
.pin-table .lb-bar { display: none; }
.pin-table .award-set { margin-left: 6px; gap: 5px; }
.pin-table .lb-name a { font-size: 15px; }
.pin-table .peek { margin-right: 6px; }
.pin-panel .panel-head { padding-left: 8px; padding-right: 8px; }
.pin-table .net-now { font-size: 15px; margin-right: 4px; }
.period-tabs { display: flex; gap: 3px; flex-wrap: wrap; }
.chip-sm { padding: 3px 8px; font-size: 11.5px; letter-spacing: .05em; }
.pin-panel .panel-head { align-items: flex-start; }
.fill-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px dashed var(--line); border-radius: 3px;
  font-family: var(--display); font-weight: 600; font-size: 10.5px; letter-spacing: .06em; color: var(--muted); vertical-align: middle;
}
.pin-table tr.is-filler .lb-name a { opacity: .8; }
.pin-podium .lb-wr, .pin-cold .lb-wr { font-weight: 700; }
.pin-table td.win .award { cursor: help; }
.empty-sm { padding: 18px 12px; font-size: 13px; }

/* --- row effects -------------------------------------------------- */
/* one continuous overlay per row for particles (spans the row via tr{position:relative}) */
.leaderboard .lb-row.row-gold, .leaderboard .lb-row.row-cold { position: relative; }
.leaderboard .lb-row.row-gold td:first-child::before,
.leaderboard .lb-row.row-cold td:first-child::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
}
.leaderboard .lb-row.row-gold td, .leaderboard .lb-row.row-cold td { position: static; }

/* trend glow: stock going up (green) / down (red) */
.leaderboard .lb-row.row-trend-up {
  background: linear-gradient(90deg, rgba(53, 208, 127, .20), rgba(53, 208, 127, .05) 45%, rgba(53, 208, 127, .12));
  box-shadow: inset 0 0 22px -6px rgba(53, 208, 127, .55);
  animation: trend-pulse 2.6s ease-in-out infinite;
}
.leaderboard .lb-row.row-trend-down {
  background: linear-gradient(90deg, rgba(255, 90, 110, .20), rgba(255, 90, 110, .05) 45%, rgba(255, 90, 110, .12));
  box-shadow: inset 0 0 22px -6px rgba(255, 90, 110, .55);
  animation: trend-pulse 2.6s ease-in-out infinite;
}
.leaderboard .lb-row.row-trend-up td:first-child   { box-shadow: inset 3px 0 0 var(--win); }
.leaderboard .lb-row.row-trend-down td:first-child { box-shadow: inset 3px 0 0 var(--loss); }
.leaderboard .lb-row.row-trend-up .lb-name a   { color: #b8f5d3; text-shadow: 0 0 10px rgba(53, 208, 127, .7); }
.leaderboard .lb-row.row-trend-down .lb-name a { color: #ffc2ca; text-shadow: 0 0 10px rgba(255, 90, 110, .7); }
@keyframes trend-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* medal rows: only GOLD gets the fire / ember glow (declared after trend so it wins).
   Silver and bronze rows stay plain: coloured left bar + the word card. */
.leaderboard .lb-row.row-gold {
  background: linear-gradient(90deg, rgba(255, 110, 30, .30), rgba(255, 60, 20, .08) 45%, rgba(255, 140, 40, .16));
  box-shadow: inset 0 0 26px -6px rgba(255, 120, 30, .6);
  animation: ember-glow 1.8s ease-in-out infinite;
}
.leaderboard .lb-row.row-gold td:first-child::before {
  opacity: .85;
  background-image:
    radial-gradient(circle, rgba(255, 220, 120, .95) 0 1.2px, transparent 2px),
    radial-gradient(circle, rgba(255, 140, 40, .9) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255, 90, 30, .8) 0 .8px, transparent 1.5px);
  background-size: 90px 64px, 130px 72px, 70px 48px;
  animation: ember-rise 4.5s linear infinite, ember-flicker 1.3s ease-in-out infinite;
}
.leaderboard .lb-row.row-gold   td:first-child { box-shadow: inset 3px 0 0 #ffd166; }
.leaderboard .lb-row.row-silver td:first-child { box-shadow: inset 3px 0 0 #d7dfea; }
.leaderboard .lb-row.row-bronze td:first-child { box-shadow: inset 3px 0 0 #d9a066; }
.leaderboard .lb-row.row-gold .lb-name a { color: #fff1c2; text-shadow: 0 0 6px rgba(255, 209, 102, 1), 0 0 18px rgba(255, 120, 30, .8); }
.leaderboard .lb-row.row-gold td.col-rank { color: #ffb86b; }
@keyframes ember-glow   { 0%, 100% { filter: brightness(1) saturate(1); } 50% { filter: brightness(1.2) saturate(1.2); } }
@keyframes ember-rise   { from { background-position: 0 64px, 30px 92px, 60px 58px; } to { background-position: 14px 0, 22px 0, 70px 0; } }
@keyframes ember-flicker { 0%, 100% { opacity: .85; } 35% { opacity: .55; } 70% { opacity: 1; } }

/* cold rows: blue chill with falling snow */
.leaderboard .lb-row.row-cold {
  background: linear-gradient(90deg, rgba(90, 170, 255, .26), rgba(140, 210, 255, .06) 45%, rgba(90, 170, 255, .14));
  box-shadow: inset 0 0 26px -6px rgba(120, 190, 255, .55);
  animation: none;
}
.leaderboard .lb-row.row-cold td:first-child::before {
  opacity: .9;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .95) 0 1.3px, transparent 2.1px),
    radial-gradient(circle, rgba(200, 235, 255, .85) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(160, 215, 255, .7) 0 .8px, transparent 1.4px);
  background-size: 96px 70px, 140px 80px, 74px 54px;
  animation: snow-fall 6s linear infinite, snow-drift 3.2s ease-in-out infinite alternate;
}
.leaderboard .lb-row.row-cold td:first-child { box-shadow: inset 3px 0 0 #7cc8ff; }
.leaderboard .lb-row.row-cold .lb-name a { color: #d8f1ff; text-shadow: 0 0 6px rgba(140, 210, 255, .95), 0 0 16px rgba(80, 160, 255, .6); }
.leaderboard .lb-row.row-cold td.col-rank { color: #9fd8ff; }
@keyframes snow-fall  { from { background-position: 0 -70px, 40px -70px, 20px -24px; } to { background-position: 0 70px, 40px 90px, 20px 84px; } }
@keyframes snow-drift { from { background-position-x: 0, 40px, 20px; } to { background-position-x: 12px, 30px, 28px; } }

/* hover: the table's generic hover paints a flat cell background; keep the row effect instead */
.leaderboard .lb-row.row-gold:hover td, .leaderboard .lb-row.row-cold:hover td,
.leaderboard .lb-row.row-trend-up:hover td, .leaderboard .lb-row.row-trend-down:hover td { background: rgba(255, 255, 255, .04); }

/* on "Recent matches" rows the WIN/LOSS tag sits after the badges */
.leaderboard .award-set + .result-tag { margin-left: 10px; }

@media (prefers-reduced-motion: reduce) {
  .leaderboard .lb-row.row-gold, .leaderboard .lb-row.row-cold,
  .leaderboard .lb-row.row-trend-up, .leaderboard .lb-row.row-trend-down,
  .leaderboard .lb-row.row-gold td:first-child::before, .leaderboard .lb-row.row-cold td:first-child::before { animation: none; }
  .cd-main, .cd-clock, .live-badge .live-dot, .live-badge .live-dot::after { animation: none; }
}
.pin-panel .panel-head > div:first-child { flex: 1 1 100%; }
.pin-panel .period-tabs { margin-top: -2px; margin-bottom: 4px; }
@media (max-width: 1280px) {
  .pinned { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .pinned { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .countdown-banner { padding: 12px 10px 10px; }
  .cd-label { font-size: 11px; letter-spacing: .22em; }
  .cd-foot { font-size: 10px; letter-spacing: .12em; }
  .award-card { font-size: 10.5px; padding: 1px 6px 0; letter-spacing: .12em; }
  .award-set { gap: 6px; margin-left: 6px; }
  .peek { margin-right: 6px; }
  .pin-table .peek { display: none; }
  #chartPeek { width: min(324px, calc(100vw - 16px)); }
}

/* =====================================================================
   Player page: Daily / Weekly / Monthly / All-time high cards (above the main chart)
   ===================================================================== */
.highs-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.high-card {
  position: relative; padding: 12px 14px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(0, 0, 0, .1)); overflow: hidden;
}
.high-label { font-family: var(--display); font-weight: 600; font-size: 11.5px; letter-spacing: .2em; color: var(--muted); }
.high-value { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.high-value.win { color: var(--win); text-shadow: 0 0 12px rgba(53, 208, 127, .45); }
.high-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.high-sub b { font-weight: 600; color: var(--text); }
.high-sub b.win { color: var(--win); } .high-sub b.loss { color: var(--loss); }
.high-tag {
  display: inline-block; padding: 1px 6px 0; border: 1px solid var(--win); border-radius: 4px; color: var(--win);
  font-family: var(--display); font-weight: 700; font-size: 10px; letter-spacing: .14em; vertical-align: 1px;
  text-shadow: 0 0 6px rgba(53, 208, 127, .6); box-shadow: 0 0 8px rgba(53, 208, 127, .35);
}
.high-tag-soft { opacity: .75; box-shadow: none; }
.high-card.is-at-high { border-color: rgba(53, 208, 127, .45); }
.high-card.is-new-high { border-color: var(--win); box-shadow: inset 0 0 24px -8px rgba(53, 208, 127, .5), 0 0 18px -6px rgba(53, 208, 127, .45); }
.high-card.high-all { border-color: rgba(255, 209, 102, .35); }
.high-card.high-all .high-label { color: #ffd166; }
.high-card.high-all.is-new-high { border-color: #ffd166; box-shadow: inset 0 0 24px -8px rgba(255, 209, 102, .45), 0 0 18px -6px rgba(255, 209, 102, .45); }
@media (max-width: 760px) {
  .highs-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .high-value { font-size: 24px; }
}

/* =====================================================================
   Hit counter (efreecode.com / eXTReMe Tracker) — included on every page.
   The icon the script inserts is boxed to its exact size and covered by a
   layer in the page background colour; the visit is still counted.
   ===================================================================== */
.ext-tracker {
  position: relative; width: 41px; height: 38px; overflow: hidden;
  margin: 0 auto -38px; opacity: .001; pointer-events: none;   /* no visible footprint, no layout shift */
}
.ext-tracker a, .ext-tracker img { position: absolute; left: 0; top: 0; width: 41px; height: 38px; display: block; }
.ext-tracker-cover { position: absolute; inset: 0; z-index: 2; background: var(--bg); }

/* =====================================================================
   Player page: animated "0 VALUE" zero line over the main chart
   ===================================================================== */
.panel-main { position: relative; }
.zero-line {
  position: absolute; z-index: 3; pointer-events: none; height: 0;
  display: flex; justify-content: space-between; align-items: center; padding: 0 28px 0 150px;   /* left gap clears the THE BEGINNING chip */
}
.zero-line::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .85) 0 3px, transparent 3px 9px);
  animation: zero-march .6s linear infinite; opacity: .7;
}
.zero-line span {
  position: relative; transform: translateY(-50%);
  padding: 1px 7px 0; border: 1px solid rgba(255, 255, 255, .45); border-radius: 3px; background: var(--panel);
  font-family: var(--display); font-weight: 700; font-size: 10.5px; letter-spacing: .16em; color: #fff;
  text-shadow: 0 0 6px rgba(255, 255, 255, .5); animation: zero-blink 2.4s ease-in-out infinite;
}
@keyframes zero-march { from { background-position: 0 0; } to { background-position: 9px 0; } }
@keyframes zero-blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .zero-line::before, .zero-line span { animation: none; } }
