/* ---------- Base ---------- */
:root {
  --bg: #f1ead7;
  --bg-2: #ebe2ca;
  --paper: #fbf6e8;
  --paper-2: #f6efd9;
  --ink: #1f2a1a;
  --ink-2: #4a5444;
  --ink-3: #7a8270;
  --line: #d9cfae;
  --line-2: #c9bf9e;

  /* dino-inspired accents */
  --green: #2f7a3a;        /* dino body */
  --green-deep: #1d5527;
  --green-soft: #e6efd8;
  --red: #c5333e;          /* cap, used for losses */
  --red-soft: #f5dcdf;
  --pink: #cf3a87;         /* goals accent */
  --pink-soft: #f7d8e7;
  --blue: #2a5fa8;         /* clipboard */
  --blue-soft: #dbe5f2;
  --beige: #cfb979;        /* belly */
  --amber: #c98a18;

  --win: #2f7a3a;
  --refund: #c98a18;
  --loss: #c5333e;

  --radius: 14px;
  --radius-sm: 8px;

  --pad: 22px;
  --row-h: 44px;
  --gap: 18px;
}

[data-density="compact"] {
  --pad: 14px;
  --row-h: 34px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(31,42,26,0.05) 1px, transparent 0);
  background-size: 14px 14px;
}

/* ---------- Pixel typography ---------- */
.pixel { font-family: "Press Start 2P", monospace; letter-spacing: 0.5px; line-height: 1.4; }
.mono  { font-family: "JetBrains Mono", ui-monospace, monospace; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); }

/* pixel intensity layers */
[data-pixel="subtle"] .px-heading { font-family: "DM Sans", system-ui, sans-serif; letter-spacing: 0; font-weight: 700; }
[data-pixel="subtle"] .px-wordmark { font-family: "Press Start 2P", monospace; letter-spacing: 0.5px; }
[data-pixel="subtle"] .px-num { font-family: "JetBrains Mono", monospace; letter-spacing: 0; }

[data-pixel="medium"] .px-heading { font-family: "Press Start 2P", monospace; letter-spacing: 0.5px; }
[data-pixel="medium"] .px-wordmark { font-family: "Press Start 2P", monospace; }
[data-pixel="medium"] .px-num     { font-family: "JetBrains Mono", monospace; font-weight: 600; }

[data-pixel="heavy"] .px-heading { font-family: "Press Start 2P", monospace; letter-spacing: 0.5px; }
[data-pixel="heavy"] .px-wordmark { font-family: "Press Start 2P", monospace; }
[data-pixel="heavy"] .px-num     { font-family: "Press Start 2P", monospace; letter-spacing: 1px; }
[data-pixel="heavy"] body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(to bottom, rgba(31,42,26,0.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: 256px 1fr;
  height: 100vh;
  overflow: hidden;
}
[data-density="compact"] .app { grid-template-columns: 220px 1fr; }

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main {
  overflow-y: auto;
  padding: 28px 32px 60px;
}
[data-density="compact"] .main { padding: 18px 24px 40px; }

/* ---------- Sidebar ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
}
/* Button reset for the (mobile-clickable) brand row */
button.brand-toggle {
  width: 100%;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default; /* on desktop it's not interactive */
}
button.brand-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.brand-text { flex: 1; min-width: 0; }
/* Toggle hint (HISTORY label + chevron) — hidden by default, mobile shows it */
.brand-toggle-hint {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink-2);
}
.brand-toggle-label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 1px;
}
.brand-chevron {
  font-size: 12px;
  line-height: 1;
  transition: transform 0.18s ease;
  color: var(--green-deep);
}
.sidebar.history-open .brand-chevron { transform: rotate(180deg); }
.brand-logo {
  width: 40px; height: 40px;
  image-rendering: pixelated;
  border-radius: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.brand-name { font-size: 11px; color: var(--ink); }
.brand-tag  { font-size: 9px; color: var(--ink-3); margin-top: 4px; letter-spacing: 1px; }

.side-tabs {
  display: flex;
  gap: 0;
  padding: 12px 12px 6px;
  border-bottom: 1px solid var(--line);
}
.side-tab {
  flex: 1;
  background: transparent;
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 8px 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
}
.side-tab.active {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line-2);
  box-shadow: inset 0 -2px 0 var(--green);
}

.side-scroll {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0 16px;
}

.side-section-label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--ink-3);
  letter-spacing: 1px;
  padding: 14px 18px 6px;
}

.week-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.week-row:hover { background: var(--bg-2); }
.week-row.active {
  background: var(--green-soft);
  box-shadow: inset 3px 0 0 var(--green);
}
.week-row .wk-label { font-size: 12px; font-weight: 600; color: var(--ink); }
.week-row .wk-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.week-row .wk-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--ink-2);
}
.week-row .wk-badge.good { background: var(--green-soft); color: var(--green-deep); border-color: #b8d2a6; }
.week-row .wk-badge.bad  { background: var(--red-soft);   color: #8a2530;          border-color: #e6b6bb; }

.month-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 4px;
}
.month-row .m-name { font-weight: 700; font-size: 12px; }
.month-row .m-stat { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-3); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.topbar-lead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-ctx {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.topbar-ctx::before { content: "·"; margin-right: 10px; color: var(--line-2); }
.greet h1 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.5px;
}
[data-pixel="medium"] .greet h1, [data-pixel="heavy"] .greet h1 { font-size: 18px; line-height: 1.4; }
[data-pixel="subtle"] .greet h1 { font-size: 34px; }

.greet p {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

.toolbar { display: flex; gap: 10px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.pill.primary {
  background: var(--green);
  color: white;
  border-color: var(--green-deep);
}
.pill.primary:hover { background: var(--green-deep); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.win { background: var(--win); }
.dot.refund { background: var(--refund); }
.dot.loss { background: var(--loss); }

/* ---------- Cards ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  position: relative;
}
.card.flat { background: transparent; border: 1px dashed var(--line-2); }
.card.dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-title { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.card-sub   { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.card-title.px { font-family: "Press Start 2P", monospace; font-size: 9px; letter-spacing: 1px; }

/* ---------- Grid layouts ---------- */
.grid-kpis {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.grid-mid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.grid-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

/* When two alert columns sit side by side, force their cards to match heights */
.alert-pair > div { display: flex; flex-direction: column; gap: var(--gap); }
.alert-pair > div > .card:last-child { flex: 1 1 auto; }
.alert-pair > div > .card:last-child .alert-list { flex: 1 1 auto; }

/* ---------- Hero KPI ---------- */
.hero {
  background: var(--green);
  color: white;
  border: 1px solid var(--green-deep);
  border-radius: var(--radius);
  padding: var(--pad);
  position: relative;
  overflow: hidden;
}
.hero-label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: white;
}
.hero-num {
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 96px;
  line-height: 1;
  color: white;
  margin: 14px 0 6px;
}
[data-pixel="heavy"] .hero-num { font-family: "Press Start 2P", monospace; font-size: 56px; letter-spacing: 2px; }
[data-density="compact"] .hero-num { font-size: 72px; }

.hero-foot {
  display: flex; gap: 16px; align-items: center;
  margin-top: 14px;
  position: relative; z-index: 1;
}
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 5px 10px;
  border-radius: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

/* ---------- KPI mini ---------- */
.kpi {
  display: flex; flex-direction: column; gap: 8px;
}
.kpi-label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--ink-3);
  letter-spacing: 1px;
}
.kpi-num {
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink);
}
[data-pixel="heavy"] .kpi-num { font-family: "Press Start 2P", monospace; font-size: 24px; letter-spacing: 1px; }
[data-density="compact"] .kpi-num { font-size: 30px; }

.kpi-foot { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.kpi.win   .kpi-num { color: var(--win); }
.kpi.refund .kpi-num { color: var(--refund); }
.kpi.loss  .kpi-num { color: var(--loss); }

/* ---------- WRL split bar ---------- */
.wrl-bar {
  display: flex; height: 10px; border-radius: 6px; overflow: hidden;
  background: var(--line);
}
.wrl-bar > div { transition: flex 0.3s; }
.wrl-bar .w { background: var(--win); }
.wrl-bar .r { background: var(--refund); }
.wrl-bar .l { background: var(--loss); }

.legend { display: flex; gap: 14px; font-size: 11px; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Donut ---------- */
.donut-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.donut { width: 100%; aspect-ratio: 1; max-width: 180px; }
.donut-center {
  fill: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}
[data-pixel="heavy"] .donut-center { font-family: "Press Start 2P", monospace; }

.donut-stats { display: flex; flex-direction: column; gap: 8px; }
.donut-stat {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  font-size: 12px;
}
.donut-stat .swatch { width: 14px; height: 14px; border-radius: 3px; }
.donut-stat .name { color: var(--ink-2); }
.donut-stat .val { font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--ink); }

/* ---------- Line chart ---------- */
.line-chart {
  width: 100%;
  display: block;
}
.line-chart .grid line { stroke: var(--line); stroke-dasharray: 3 4; }
.line-chart .axis text { fill: var(--ink-3); font-family: "JetBrains Mono", monospace; font-size: 10px; }
.line-chart .area { fill: url(#areaGrad); }
.line-chart .line { fill: none; stroke: var(--green-deep); stroke-width: 2.5; }
.line-chart .target { stroke: var(--blue); stroke-dasharray: 4 4; stroke-width: 1.5; opacity: 0.7; }
.line-chart .target-label { fill: var(--blue); font-family: "JetBrains Mono", monospace; font-size: 10px; }
.line-chart .point { fill: var(--paper); stroke: var(--green-deep); stroke-width: 2; }

/* ---------- Alert columns ---------- */
.alert-col-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.col-tag {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
  letter-spacing: 1px;
}
.col-tag.corners { background: var(--blue); border-color: var(--blue); }
.col-tag.goals   { background: var(--pink);  border-color: var(--pink); }
.col-tag.all     { background: var(--green); border-color: var(--green-deep); }

.alert-list { display: flex; flex-direction: column; gap: 0; }
.alert-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
[data-density="compact"] .alert-row { padding: 6px 4px; }
.alert-row:last-child { border-bottom: none; }

.alert-row .match {
  display: flex; flex-direction: column;
  min-width: 0;
}
.alert-row .teams {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.alert-row .meta {
  font-size: 11px; color: var(--ink-3);
  font-family: "JetBrains Mono", monospace;
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-density="compact"] .alert-row .teams { font-size: 12px; }
[data-density="compact"] .alert-row .meta  { font-size: 10px; margin-top: 0; }

/* W/R/L pixel chip */
.wrl {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  color: white;
  background: var(--win);
  position: relative;
  image-rendering: pixelated;
}
.wrl.W { background: var(--win); }
.wrl.R { background: var(--refund); }
.wrl.L { background: var(--loss); }
[data-density="compact"] .wrl { width: 22px; height: 22px; font-size: 9px; }

[data-pixel="subtle"] .wrl {
  border-radius: 50%;
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 12px;
}

.line-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ---------- League table ---------- */
.lb-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  margin: 0 0 14px 0;
}
.lb-tog {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--ink-3);
  cursor: pointer;
}
.lb-tog:hover { color: var(--ink); }
.lb-tog.active { background: var(--ink); color: var(--paper); }
.lb-tog.corners.active { background: var(--blue); color: white; }
.lb-tog.goals.active   { background: var(--pink); color: white; }

.league-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.league-table col.c-name   { width: auto; }
.league-table col.c-num    { width: 56px; }
.league-table col.c-num-sm { width: 48px; }
.league-table col.c-split  { width: 120px; }
.league-table col.c-rate   { width: 100px; }
.league-table th {
  text-align: left;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  font-weight: normal;
  color: var(--ink-3);
  letter-spacing: 1px;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.league-table th.num { text-align: right; padding-right: 14px; padding-left: 14px; }
.league-table th:last-child, .league-table td:last-child { padding-right: 0; }
.league-table th:first-child, .league-table td:first-child { padding-left: 0; }
.league-table td {
  padding: 10px 14px 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
}
.league-table td.num {
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  padding-right: 14px;
  padding-left: 14px;
}
.league-table tr:last-child td { border-bottom: none; }
[data-density="compact"] .league-table td { padding: 6px 12px 6px 0; font-size: 12px; }
[data-density="compact"] .league-table td.num { padding-left: 12px; padding-right: 12px; }

.league-name {
  display: flex; align-items: center; gap: 10px;
}
.flag {
  width: 22px; height: 16px;
  border-radius: 3px;
  background: var(--line);
  font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
}

.mini-bar {
  display: inline-flex; height: 6px; width: 100px;
  border-radius: 3px; overflow: hidden; background: var(--line);
  vertical-align: middle;
}
.mini-bar > div:first-child { background: var(--win); }
.mini-bar > div:nth-child(2) { background: var(--refund); }
.mini-bar > div:nth-child(3) { background: var(--loss); }

/* ---------- Tabs ---------- */
.top-tabs {
  display: flex; gap: 6px;
  background: var(--paper);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.top-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-2);
  cursor: pointer;
}
.top-tab.active { background: var(--ink); color: var(--paper); }

/* ---------- Join via Telegram button ---------- */
/* Sized so box (33px) + hard shadow (2px) = 35px, matching the .top-tabs toggle envelope. */
.tg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 0 16px;
  position: relative;
  top: -1px; /* lift so box + shadow optically centre on the toggle */
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: #229ED9;
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 2px 2px 0 #15658c;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.tg-btn svg { width: 14px; height: 14px; flex: none; }
.tg-btn:hover { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #15658c; }
.tg-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 #15658c; }

/* ---------- Misc ---------- */
.spark { height: 28px; width: 80px; }
.spark path { fill: none; stroke: var(--green-deep); stroke-width: 1.5; }

.row-foot {
  display: flex; gap: 14px; align-items: center;
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-3);
  font-family: "JetBrains Mono", monospace;
}

/* ---------- Site footer ---------- */
.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.foot-brand {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--ink-2);
}
.foot-sep { color: var(--line-2); }
.foot-link {
  margin-left: auto;
  color: var(--green-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.foot-link:hover { border-bottom-color: var(--green-deep); }
.foot-fine {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.6;
  max-width: 720px;
  text-wrap: pretty;
}
.foot-copy {
  margin: 8px 0 0;
  font-size: 10px;
  color: var(--line-2);
}
/* Live sync pill now lives in the footer, pinned right where the subscribe link was */
.foot-row .pill { margin-left: auto; cursor: default; }

@media (max-width: 760px) {
  .foot-link { margin-left: 0; }
  .foot-row .pill { margin-left: 0; }
}

/* prominent W/R/L/A stat row — sized to match alert-list row-foot */
.wrl-stats {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.wrl-stats .stat {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-weight: 700;
}
.wrl-stats .stat .lbl {
  font-weight: 700;
  opacity: 0.9;
}
.wrl-stats .stat.win    { color: var(--win); }
.wrl-stats .stat.refund { color: var(--refund); }
.wrl-stats .stat.loss   { color: var(--loss); }
.wrl-stats .stat.alerts { color: var(--ink); }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

.scroll-y { overflow-y: auto; }

/* ---------- All-time stats specific ---------- */
.bigstat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.tlog {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-3);
}

/* ---------- Streaks ---------- */
.streaks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.streak-tile {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.streak-label {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.streak-sub {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.streak-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
[data-pixel="heavy"] .streak-num { font-family: "Press Start 2P", monospace; font-size: 24px; letter-spacing: 1px; }
[data-density="compact"] .streak-num { font-size: 28px; }
[data-density="compact"] .streak-tile { padding: 12px 14px; }
/* ---------- P&L card ---------- */
.pnl-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin: 14px 0 18px;
}
.pnl-stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.pnl-lbl {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.pnl-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
[data-pixel="heavy"] .pnl-num { font-family: "Press Start 2P", monospace; font-size: 18px; letter-spacing: 1px; }
[data-density="compact"] .pnl-num { font-size: 22px; }
[data-density="compact"] .pnl-stat { padding: 10px 12px; }
.pnl-foot {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 10px;
}

/* ---------- Mobile (≤720px) ---------- */
/* Sidebar stays put as a stacked section on top; main content flows below.
   Grids collapse to single column. Wide tables get horizontal scroll. */
@media (max-width: 720px) {
  /* Let the page scroll naturally instead of locking to viewport */
  html, body, #root { height: auto; min-height: 100%; }
  body { font-size: 14px; }

  .app {
    display: block;
    height: auto;
    overflow: visible;
  }

  /* Sidebar: full width, natural height, sits above main */
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: none;
    overflow: visible;
  }
  .side-scroll {
    overflow-y: visible;
    flex: none;
  }
  /* Mobile: brand row is the toggle. Show the HISTORY/chevron affordance,
     and hide the history list when collapsed. */
  button.brand-toggle { cursor: pointer; }
  .brand-toggle-hint { display: inline-flex; }
  .sidebar.history-closed .side-scroll { display: none; }
  .sidebar.history-closed .brand { border-bottom: none; }

  /* Main: lighter padding, no inner scroll */
  .main {
    overflow-y: visible;
    padding: 20px 16px 60px;
  }
  [data-density="compact"] .main { padding: 14px 12px 40px; }

  /* Top bar stacks */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 18px;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .greet h1 { font-size: 22px; }
  [data-pixel="medium"] .greet h1,
  [data-pixel="heavy"] .greet h1 { font-size: 14px; line-height: 1.5; }
  [data-pixel="subtle"] .greet h1 { font-size: 24px; }

  /* Tabs may overflow — let them scroll horizontally */
  .top-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .top-tab { flex: 0 0 auto; }

  /* All grids collapse to a single column */
  .grid-kpis,
  .grid-mid,
  .grid-bottom,
  .bigstat-grid,
  .pnl-summary,
  .streaks-grid {
    grid-template-columns: 1fr;
  }
  /* Reset any child grid-column/grid-row spans so nothing forces a phantom 2nd track.
     !important is required to beat inline style={{ gridColumn: "span 2" }} on the hero. */
  .grid-kpis > *,
  .grid-mid > *,
  .grid-bottom > *,
  .bigstat-grid > *,
  .pnl-summary > *,
  .streaks-grid > *,
  .alert-pair > * {
    grid-column: auto !important;
    grid-row: auto !important;
  }

  /* Hero KPI: smaller display number */
  .hero-num { font-size: 64px; }
  [data-pixel="heavy"] .hero-num { font-size: 40px; letter-spacing: 1px; }
  [data-density="compact"] .hero-num { font-size: 56px; }
  .hero-foot { flex-wrap: wrap; gap: 8px; }

  /* Mini KPIs shrink a touch */
  .kpi-num { font-size: 32px; }
  [data-pixel="heavy"] .kpi-num { font-size: 20px; }

  /* Streak/P&L stat tiles look fine stacked at full width */
  .streak-num { font-size: 30px; }
  .pnl-num { font-size: 24px; }

  /* Donut: stack donut over legend */
  .donut-wrap { grid-template-columns: 1fr; }
  .donut { max-width: 200px; margin: 0 auto; }

  /* League table: horizontal scroll inside its card so the data shape is preserved */
  .card:has(> .league-table),
  .card:has(> .lb-toggle) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .league-table {
    min-width: 560px;
    table-layout: auto;
  }

  /* Alert rows: keep three-column layout but tighten gaps */
  .alert-row {
    grid-template-columns: 24px 1fr auto;
    gap: 8px;
    padding: 10px 2px;
  }
  .alert-row .teams { font-size: 12px; }
  .alert-row .meta  { font-size: 10px; }

  /* WRL stats row wraps */
  .wrl-stats { flex-wrap: wrap; gap: 10px 14px; }
  .row-foot  { flex-wrap: wrap; gap: 8px 14px; }
}

/* scrollbar */
.side-scroll::-webkit-scrollbar, .main::-webkit-scrollbar { width: 10px; }
.side-scroll::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 6px;
}
.side-scroll::-webkit-scrollbar-track, .main::-webkit-scrollbar-track {
  background: transparent;
}
