:root {
  /* Bet log "Play" column: body text starts at pad + logo rail + gap (must match th padding on col 4) */
  --play-table-pad-x: 12px;
  --play-logo-rail: 36px;
  --play-logo-gap: 4px;
  /*
   * Matches Cursor built-in “Cursor Dark” (theme-cursor/cursor-dark-color-theme.json, Anysphere).
   * Surfaces: activityBar/sideBar/panel #141414; editor #181818; line highlight / hover #262626.
   * Text: editor.foreground #E4E4E4; secondary/muted from sidebar & section headers (alpha on E4E4E4).
   * Accent UI: #88C0D0 — Nord cyan; wins #3FA266 (charts.green); amber #F1B467 (charts.yellow).
   * Loss red: theme charts.red #E34671 reads much brighter than green at equal use; --red is darkened for perceptual parity with --green.
   */
  --bg-primary: #141414;
  --bg-card: #181818;
  --bg-elevated: #1c1c1c;
  --bg-hover: #262626;
  --border: rgba(228, 228, 228, 0.075);
  --border-bright: rgba(228, 228, 228, 0.15);
  --border-faint: rgba(228, 228, 228, 0.05);
  --border-row: rgba(228, 228, 228, 0.045);
  --text-primary: #e4e4e4;
  --text-secondary: #9e9e9e;
  --text-muted: #6e6e6e;
  --accent: #88c0d0;
  --cyan: var(--accent);
  --green: #3fa266;
  --red: #b84d62;
  --orange: #f1b467;
  --accent-soft: rgba(136, 192, 208, 0.12);
  --accent-mid: rgba(136, 192, 208, 0.36);
  --chrome-45: rgba(228, 228, 228, 0.12);
  --chrome-55: rgba(228, 228, 228, 0.18);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 0 rgba(228, 228, 228, 0.04) inset, 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.55);
  --font: 'Inter', system-ui, sans-serif;
  /* Caustic CS2 / VAL: same badge recipe as .result-won / .result-lost (base rgb + soft label text) */
  --game-cs2-rgb: 56, 208, 240;
  --game-cs2-text: #5ec8dc;
  --game-val-rgb: 208, 112, 248;
  --game-val-text: #e898f0;
}

html { color-scheme: dark; }

* { margin: 0; padding: 0; box-sizing: border-box; }
button { font-family: var(--font); }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.dashboard { max-width: 1400px; margin: 0 auto; padding: 14px; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.top-stats { background: transparent; border: none; padding: 0; margin-bottom: 12px; display: flex; gap: 10px; align-items: stretch; flex-shrink: 0; }
.ts-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 22px; display: flex; gap: 24px; align-items: center; flex: 1; box-shadow: var(--shadow-card); }
.ts-item { display: flex; flex-direction: column; gap: 3px; }
.pnl-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.pnl-value { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ts-value { font-size: 20px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pnl-positive { color: var(--green); }
.pnl-negative { color: var(--red); }
.pnl-neutral { color: var(--text-secondary); }
.stats-grid { display: flex; gap: 24px; align-items: center; }
.stat-item { text-align: center; }
.stat-number { font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }

.main-grid { display: grid; grid-template-columns: 1fr 300px; gap: 12px; flex: 1; min-height: 0; }
.left-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
/* Chart fills extra column height; bet log sizes to its table (no empty stretch below rows). */
.left-col .card:first-child {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.left-col .card:first-child .chart-wrap {
  flex: 1;
  /* Must shrink when bet log is tall; fixed min-height + overflow:hidden on .card was clipping the chart bottom. */
  min-height: 0;
  height: auto;
}
.left-col .card:last-child {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.left-col .table-wrap { flex: 0 0 auto; min-height: 0; }
.left-col .table-body-scroll {
  flex: 0 1 auto;
  /* Leave room for top stats, chart header, ~min chart, gaps — avoids pushing chart out of the column. */
  max-height: min(420px, calc(100vh - 380px));
}
/* Slightly taller bet rows + logos (aligned) — easier read + cleaner snap vs subpixel clipping */
.left-col .table-header-wrap th,
.left-col .table-body-scroll td {
  padding-top: 8px;
  padding-bottom: 8px;
}
.left-col .logo-slot {
  width: 24px;
  height: 24px;
}
.left-col .team-logo {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
}
/* Play column: header "Play" aligns with body text (not the logo rail); one rail width for all rows */
.left-col .table-header-wrap th:nth-child(4) {
  padding-left: calc(var(--play-table-pad-x) + var(--play-logo-rail) + var(--play-logo-gap));
}
/* Play column: fixed logo rail + text; CS2 + props use same rail so text x is identical */
.left-col .play-cell {
  display: flex;
  align-items: center;
  gap: var(--play-logo-gap);
  width: 100%;
  min-width: 0;
  min-height: 24px;
}
.left-col .play-cell .logo-slot {
  flex: 0 0 var(--play-logo-rail);
  width: var(--play-logo-rail);
  min-width: var(--play-logo-rail);
  max-width: var(--play-logo-rail);
  height: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.left-col .play-cell .logo-slot .team-logo,
.left-col .play-cell .logo-slot .team-logo--prop {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--play-logo-rail);
  max-height: 24px;
  object-fit: contain;
  object-position: center center;
  min-width: 0;
  min-height: 0;
}
.left-col .logo-slot--prop {
  width: 24px;
  height: 24px;
}
.left-col .team-logo--prop {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}
/* Ellipsis on play text; play column td allows logo+text flex without clipping */
.left-col .table-body-scroll td:nth-child(4) {
  overflow: visible;
}
.left-col .play-cell .play-cell-text {
  position: relative;
  z-index: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.right-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; height: 100%; }
.right-col .seq-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.right-col .seq-card .seq-wrap { flex: 1; min-height: 0; height: auto !important; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.card-body { padding: 10px 14px; }
.chart-wrap { padding: 10px 14px; height: 300px; position: relative; }

.chart-tooltip { position: absolute; pointer-events: none; background: var(--bg-elevated); border: 1px solid var(--border-bright); border-radius: var(--radius-md); padding: 10px 14px; font-family: var(--font); box-shadow: var(--shadow-float); z-index: 100; transition: opacity 0.1s ease; white-space: nowrap; }
.chart-tooltip-play { font-size: 11px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.chart-tooltip-value { font-size: 14px; font-weight: 700; }

.cat-row { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.cat-row:last-child { border-bottom: none; }
.cat-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-sm); white-space: nowrap; color: var(--text-secondary); background: rgba(136, 192, 208, 0.08); border: 1px solid rgba(136, 192, 208, 0.16); }
.cat-pnl { font-size: 13px; font-weight: 600; margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }

.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--border-faint); min-height: 28px; }
.stat-row:last-child { border-bottom: none; }
.stat-row-label { font-size: 12px; color: var(--text-secondary); }
.stat-row-value { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.table-wrap { overflow: hidden; display: flex; flex-direction: column; }
.table-header-wrap { overflow-y: scroll; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.table-header-wrap::-webkit-scrollbar { width: 4px; }
.table-header-wrap::-webkit-scrollbar-thumb, .table-header-wrap::-webkit-scrollbar-track { background: transparent; }
.table-body-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--chrome-55) transparent; scroll-snap-type: y mandatory; position: relative; }
.table-body-scroll tr { scroll-snap-align: start; }
.table-body-scroll::-webkit-scrollbar { width: 4px; height: 4px; }
.table-body-scroll::-webkit-scrollbar-track { background: transparent; }
.table-body-scroll::-webkit-scrollbar-thumb { background: var(--chrome-55); border-radius: 4px; }
.table-body-scroll::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }
.seq-wrap { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 10px 14px; align-content: center; overflow: hidden; scrollbar-width: thin; scrollbar-color: var(--chrome-55) transparent; }
.seq-block { aspect-ratio: 1; border-radius: var(--radius-sm); transition: transform 0.15s cubic-bezier(0.34, 1.2, 0.64, 1); cursor: default; }
.seq-block:hover { transform: scale(1.3); z-index: 2; position: relative; }
.seq-won { background: var(--green); opacity: 0.92; }
.seq-lost { background: var(--red); opacity: 0.92; }
.seq-push { background: var(--orange); opacity: 0.92; }
.seq-pending { background: var(--text-muted); opacity: 0.55; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 7px 12px; text-align: center; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); z-index: 4; box-shadow: 0 1px 0 var(--border); }
td { padding: 7px 12px; border-bottom: 1px solid var(--border-row); font-size: 12px; color: var(--text-secondary); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th:nth-child(4), td:nth-child(4) { text-align: left; }
td:nth-child(1), td:nth-child(2), td:nth-child(5), td:nth-child(6) { font-variant-numeric: tabular-nums; }
tr:hover td { background: var(--bg-hover); }
.dd-row { background: rgba(184, 77, 98, 0.09); }
.dd-row td { background: transparent; }
tr.dd-row:hover td { background: rgba(184, 77, 98, 0.15); }

.note-ref { font-size: 9px; font-family: var(--font); font-weight: 600; position: relative; top: -4px; color: var(--cyan); cursor: default; margin-left: 2px; opacity: 0.5; transition: opacity 0.15s; letter-spacing: 0; }
[data-note]:hover .note-ref { opacity: 1; }
.note-tooltip { position: fixed; background: var(--bg-elevated); border: 1px solid var(--border-bright); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 11px; color: var(--text-secondary); pointer-events: none; z-index: 1000; display: none; white-space: nowrap; box-shadow: var(--shadow-float); }

.result-badge { font-size: 10px; font-weight: 600; padding: 3px 10px; border-radius: 5px; text-transform: uppercase; letter-spacing: 1px; border: 1px solid transparent; display: inline-block; }
.result-won { background: rgba(63, 162, 102, 0.12); color: #5f9f75; border-color: rgba(63, 162, 102, 0.3); }
.result-lost { background: rgba(184, 77, 98, 0.12); color: #e8889f; border-color: rgba(184, 77, 98, 0.3); }
.result-pending { background: rgba(228, 228, 228, 0.04); color: var(--text-secondary); border-color: var(--border-faint); }
.result-push { background: rgba(241, 180, 103, 0.12); color: #f5cb8a; border-color: rgba(241, 180, 103, 0.3); }

.stats-card-body { padding: 6px 14px; height: 174px; overflow: hidden; }
/* Team statistics tab only: compact logos so rows match General (text-only) row height */
.stats-card-body .stat-row-value .logo-slot {
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stats-card-body .stat-row-value .team-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 16px;
  max-height: 16px;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
}
/* Same slot box for CS2 + props so play column lines up in Overall / across views */
.logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
/* Fixed box from first paint — no JS resize (avoids load-time flicker). */
.team-logo {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.logo-slot--prop { width: 22px; height: 22px; }
.team-logo--prop {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  object-fit: contain;
}
.play-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 14px; border-top: 1px solid var(--border); }
.page-btn { font-size: 11px; font-weight: 600; padding: 6px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.page-btn:hover:not(:disabled) { border-color: var(--border-bright); color: var(--text-primary); }
.page-btn:disabled { opacity: 0.3; cursor: default; }
.page-btn.active { border-color: var(--cyan); color: var(--cyan); background: var(--accent-soft); }

.unit-toggle,
.screenshot-btn {
  position: fixed;
  right: 14px;
  z-index: 1000;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 1px;
  opacity: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.unit-toggle { top: 10px; }
.screenshot-btn { top: 38px; }
.unit-toggle:hover,
.screenshot-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }
.sport-toggle { position: fixed; top: 66px; right: 14px; z-index: 1000; font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; letter-spacing: 1px; opacity: 0; transition: opacity 0.15s; }
.sport-toggle:hover { opacity: 1; }
.sport-toggle.active { opacity: 0; border-color: var(--orange); color: var(--orange); background: rgba(241, 180, 103, 0.14); }
.sport-toggle.active:hover { opacity: 1; }

.stat-tabs { display: flex; gap: 6px; }
.stats-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 14px 4px; border-bottom: 1px solid var(--border-faint); }
.stats-sub-item { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.stats-sub-label { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.stats-sub-record { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.stats-sub-pnl { font-size: 11px; font-weight: 600; }
.stats-split { padding: 4px 14px 6px; border-bottom: 1px solid var(--border-faint); display: flex; flex-direction: column; gap: 4px; }
.split-row { display: flex; align-items: center; gap: 6px; }
.split-count { font-size: 10px; font-weight: 600; color: var(--text-muted); min-width: 16px; }
.split-count-right { text-align: right; }
.split-track { flex: 1; height: 4px; background: var(--bg-primary); border-radius: 2px; overflow: hidden; display: flex; }
.split-a { height: 100%; background: var(--accent-mid); border-radius: 2px 0 0 2px; }
.split-b { height: 100%; background: var(--accent-soft); border-radius: 0 2px 2px 0; }
.stat-tab { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.stat-tab:hover { border-color: var(--border-bright); color: var(--text-secondary); }
.stat-tab.active { border-color: var(--cyan); color: var(--cyan); background: var(--accent-soft); }
.stat-tab:disabled { opacity: 0.42; cursor: default; pointer-events: none; }
.stat-tab:disabled:hover { border-color: var(--border); color: var(--text-muted); }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--chrome-45); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

.bet-search-wrap { display: flex; align-items: center; gap: 8px; position: relative; }
.bet-search-dropdown { position: absolute; top: calc(100% + 6px); right: 0; background: var(--bg-elevated); border: 1px solid var(--border-bright); border-radius: var(--radius-md); padding: 0; z-index: 200; width: max-content; max-height: 200px; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: thin; scrollbar-color: var(--chrome-55) transparent; box-shadow: var(--shadow-float); }
.bet-search-dropdown::-webkit-scrollbar { width: 4px; }
.bet-search-dropdown::-webkit-scrollbar-track { background: transparent; }
.bet-search-dropdown::-webkit-scrollbar-thumb { background: var(--chrome-55); border-radius: 4px; }
.bet-search-dropdown.hidden { display: none; }
.bet-search-drop-item { display: flex; align-items: center; gap: 6px; padding: 5px 14px 5px 8px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.bet-search-drop-item .logo-slot:not(.logo-slot--prop) {
  flex: 0 0 var(--play-logo-rail);
  width: var(--play-logo-rail);
  min-width: var(--play-logo-rail);
  max-width: var(--play-logo-rail);
  height: 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bet-search-drop-item .logo-slot:not(.logo-slot--prop) .team-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--play-logo-rail);
  max-height: 24px;
  object-fit: contain;
  object-position: center center;
  min-width: 0;
  min-height: 0;
}
.bet-search-drop-item:hover { background: var(--bg-hover); }
.bet-search-drop-key { font-size: 11px; font-weight: 600; color: var(--cyan); letter-spacing: 0.3px; }
.bet-search-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 2px; display: flex; align-items: center; border-radius: 4px; transition: color 0.15s; flex-shrink: 0; }
.bet-search-btn:hover { color: var(--text-secondary); }
.bet-search-btn.active { color: var(--cyan); }
.bet-search-input { background: transparent; border: none; border-bottom: 1px solid var(--border-bright); color: var(--text-secondary); font-size: 11px; font-family: var(--font); outline: none; width: 80px; max-width: 0; overflow: hidden; padding: 0; height: 14px; line-height: 14px; letter-spacing: 0.5px; opacity: 0; pointer-events: none; transition: max-width 0.2s ease, opacity 0.15s ease; }
.bet-search-input:focus { color: var(--text-primary); }
.bet-search-input.visible { max-width: 400px; opacity: 1; pointer-events: auto; }
.bet-search-sizer { position: absolute; visibility: hidden; white-space: pre; font-size: 11px; font-family: var(--font); letter-spacing: 0.5px; pointer-events: none; }
.bet-search-input::placeholder { color: var(--text-muted); }
.bet-search-no-results { text-align: center; padding: 24px 12px; color: var(--text-muted); font-size: 12px; letter-spacing: 0.5px; }

/* Card .anim / .d2–.d5: entrance animations removed — full #app re-render on sport switch made staggered fadeUp read as flicker. */

.view-toggles {
  position: fixed;
  top: 10px;
  left: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.view-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.view-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.view-btn.active { border-color: var(--cyan); color: var(--cyan); background: var(--accent-soft); }

button:focus-visible,
.page-btn:focus-visible,
.stat-tab:focus-visible,
.view-btn:focus-visible,
.unit-toggle:focus-visible,
.screenshot-btn:focus-visible,
.sport-toggle:focus-visible,
.bet-search-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}