:root {
  --bg: #0f1421;
  --bg-deep: #0a0e18;
  --surface: #1a1f2e;
  --surface-raised: #242b3d;
  --line: #2d3550;
  --chalk: #ffffff;
  --chalk-muted: #9caac0;
  --amber: #1db1ff;
  --amber-dim: rgba(29, 177, 255, 0.35);
  --home: #1db1ff;
  --away: #ff6b35;
  --draw: #f5c842;
  --gf-tint: rgba(0, 212, 139, 0.35);
  --ga-tint: rgba(255, 68, 102, 0.35);
  --good: #00d48b;
  --bad: #ff4466;
  --brand-pitch: #ffffff;
  --brand-pulse: #1db1ff;
  --track: rgba(255, 255, 255, 0.08);
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 8px;
}

html.light {
  --bg: #f4f6fb;
  --bg-deep: #e7ebf4;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --line: #dbe1ee;
  --chalk: #10151f;
  --chalk-muted: #626c81;
  --amber: #0b79b3;
  --amber-dim: rgba(11, 121, 179, 0.3);
  --home: #0b79b3;
  --away: #d85a26;
  --draw: #b8860b;
  --good: #0a9f6c;
  --bad: #d92a4d;
  --brand-pitch: #0b79b3;
  --brand-pulse: #d85a26;
  --track: rgba(16, 21, 31, 0.08);
}
html.light .theme-icon.sun { display: none; }
html.light .theme-icon.moon { display: block; }
.theme-icon.moon { display: none; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--chalk);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

/* flat dark background, matching ScoreMatrix's dashboard look */
.pitch-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-color: var(--bg);
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 99;
  padding: 8px;
  gap: 6px;
  margin: 14px 0 18px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 9px 16px;
  color: var(--chalk-muted);
  cursor: pointer;
  border-radius: 999px;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
.tab-icon { flex-shrink: 0; }
.tab:hover { color: var(--chalk); border-color: var(--amber-dim); }
.tab:active { transform: scale(0.96); }
.tab.active {
  color: #fff;
  background: var(--amber);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(29, 177, 255, 0.35);
}

/* ---------- sections (tab panels) ---------- */
.section { display: none; }
.section.active { display: block; }

/* ---------- manage leagues (custom league add/edit/import/export) ---------- */
.lgm-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--bg-deep);
  transition: border-color 0.2s ease;
}
.lgm-accordion.open { border-color: var(--amber-dim); }
.lgm-header {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--chalk-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.lgm-header:hover { background: rgba(29, 177, 255, 0.06); color: var(--amber); }
.lgm-icon { display: inline-flex; width: 12px; height: 12px; margin-right: 7px; flex-shrink: 0; color: var(--chalk-muted); }
.lgm-header:hover .lgm-icon { color: var(--amber); }
.lgm-accordion.open .lgm-vbar { transform: scaleY(0); opacity: 0; transform-origin: 5.5px 5.5px; transition: transform 0.2s ease, opacity 0.15s ease; }
.lgm-vbar { transform-origin: 5.5px 5.5px; transition: transform 0.2s ease, opacity 0.15s ease; }
.lgm-body { max-height: 0; overflow: hidden; opacity: 0; padding: 0 8px; transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.25s ease; }
.lgm-accordion.open .lgm-body { max-height: 100px; opacity: 1; padding: 8px 8px 10px; }
.lg-row-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; }

.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--chalk-muted);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.lg-btn:hover { border-color: var(--amber); color: var(--amber); }
.lg-btn:active { transform: scale(0.94); }
.lg-btn.lg-btn-accent { border-color: var(--amber-dim); color: var(--amber); }
.lg-btn.lg-btn-danger { padding: 6px 10px; font-size: 10px; }
.lg-btn.lg-btn-danger:hover { border-color: var(--bad); color: var(--bad); }

.lg-status-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.lg-custom-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--good);
  background: rgba(0, 212, 139, 0.12);
  border: 1px solid rgba(0, 212, 139, 0.3);
  padding: 4px 8px;
  border-radius: 5px;
}
#lg-save-msg { font-size: 11px; font-weight: 600; }

.lg-add-form { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.25s ease; }
.lg-add-form.open { max-height: 400px; opacity: 1; margin-top: 10px; }
.lg-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.lg-add-form .field { display: flex; flex-direction: column; gap: 5px; }
.lg-add-form .field label { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--chalk-muted); }
.lg-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
}
.lg-input:focus { outline: none; border-color: var(--amber-dim); }
.lg-add-actions { display: flex; gap: 8px; margin-top: 10px; }
.lg-add-actions .lg-btn { flex: 1; padding: 9px; }
#lg-add-error { font-size: 11px; color: var(--bad); margin-top: 8px; display: none; }
@media (max-width: 480px) {
  .lg-row-grid { grid-template-columns: 1fr 1fr; }
  .lg-add-grid { grid-template-columns: 1fr; }
}

/* ---------- header ----------
   One compact row: logo left, computed-stats strip centered, actions right —
   mirrors ScoreMatrix's single-bar header instead of a two-tier stack. */
.site-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-deep), var(--bg));
  position: relative;
  z-index: 1;
}
.site-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
  padding-bottom: 10px;
  min-height: 52px;
}
.brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--amber);
  border: 2px solid var(--amber-dim);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  flex-shrink: 0;
}
.brand-mark svg { filter: drop-shadow(0 0 3px var(--amber-dim)); }
.pulse-line {
  stroke-dasharray: 74 74;
  stroke-dashoffset: 74;
  animation: pulseSweep 2.4s linear infinite;
}
@keyframes pulseSweep {
  to { stroke-dashoffset: -74; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-line { animation: none; stroke-dashoffset: 0; }
}
h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.2px;
  margin: 0;
  white-space: nowrap;
}
.brand-pitch, .brand-pulse {
  background-repeat: no-repeat;
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: brandShimmer 3.2s ease-in-out infinite;
}
.brand-pitch {
  background-image: linear-gradient(100deg, var(--brand-pitch) 32%, var(--brand-pulse) 50%, var(--brand-pitch) 68%);
}
.brand-pulse {
  background-image: linear-gradient(100deg, var(--brand-pulse) 32%, var(--brand-pitch) 50%, var(--brand-pulse) 68%);
  animation-delay: 0.2s;
}
@keyframes brandShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .brand-pitch, .brand-pulse { animation: none; background-position: 0 0; }
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius);
  padding: 11px 22px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--amber); color: var(--bg-deep); font-weight: 700; }
.btn.primary:hover { background: #4dc3ff; }
.btn.ghost { background: transparent; color: var(--chalk); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--amber-dim); }
.hidden { display: none !important; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.head-actions .btn:not(.icon-btn) { padding: 8px 14px; font-size: 12px; }
.btn.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
}

/* ---------- team cards ---------- */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 680px) {
  .teams-grid { grid-template-columns: 1fr; }
}
.team-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.team-card.home { border-top: 3px solid var(--home); }
.team-card.away { border-top: 3px solid var(--away); }
.team-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
/* Away header mirrors itself — badge and name flip to the right, in line
   with GF sitting in the right-hand column of its match rows below —
   giving a quick visual cue for which card is which at a glance. */
.team-card.away .team-card-head { flex-direction: row-reverse; }
.team-card.away .team-name { text-align: right; }
.side-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--bg-deep);
  background: var(--chalk-muted);
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.team-card.home .side-tag { background: var(--home); }
.team-card.away .side-tag { background: var(--away); color: var(--chalk); }
.team-name {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--chalk);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  width: 100%;
  padding: 2px 0;
}
.team-name:focus { outline: none; border-bottom-color: var(--amber-dim); }
.hint { color: var(--chalk-muted); font-size: 12px; margin: 6px 0 14px; }

.match-rows { display: flex; flex-direction: column; gap: 6px; }
.match-row {
  display: grid;
  grid-template-columns: 22px 1fr 1fr;
  gap: 6px;
  align-items: center;
}
.match-row .idx {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--chalk-muted);
  text-align: center;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
}
.match-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 4px 4px 10px;
  min-height: 40px;
  transition: border-color 0.12s ease, background-color 0.15s ease;
  touch-action: manipulation;
}
/* Brief highlight so a tap/keystroke on a score reads as acknowledged —
   pairs with the live recompute (no more silent no-op until "Compute"). */
.match-row label:active { background: var(--surface-raised); }
.match-row label.gf-label { border-color: var(--gf-tint); }
.match-row label.ga-label { border-color: var(--ga-tint); }
.match-row label:focus-within { border-color: var(--amber); }
.match-row label span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--chalk-muted);
  flex-shrink: 0;
}
.match-row label.gf-label span { color: #00d48b; }
.match-row label.ga-label span { color: #ff4466; }
.match-row input {
  background: transparent;
  border: none;
  color: var(--chalk);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  width: 100%;
  min-width: 0;
  text-align: center;
  touch-action: manipulation;
  caret-color: transparent;
}
.match-row input:focus { outline: none; }

/* ---------- GF/GA loop scroller ----------
   One vertical up/down control instead of side-by-side −/+ buttons: tap ▲
   or ▼ to step the value, wrapping 0→1→2→3→4→5→0→... in either direction. */
.match-row .loop-scroller {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.match-row .rocker {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 28px;
  height: 34px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.match-row .rocker-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: none;
  color: var(--chalk-muted);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.match-row .rocker-btn.up { border-bottom: 1px solid var(--line); }
.match-row .rocker-btn:hover { color: var(--chalk); }
.match-row .rocker-btn:active { background: var(--amber); color: #fff; transform: scale(0.94); }

@media (max-width: 480px) {
  /* Score entry is the most-tapped part of the app on phones — give the
     up/down scroller real thumb-sized targets instead of squeezing it down
     with everything else. */
  .match-row { grid-template-columns: 18px 1fr 1fr; gap: 4px; }
  .match-row label { padding: 2px 2px 2px 8px; min-height: 48px; }
  .match-row .rocker { width: 36px; height: 42px; }
  .match-row .rocker-btn { font-size: 10px; }
}

/* ---------- shared number-input stepper ----------
   Every number input (match rows, league avg, O/U line) gets larger custom
   +/- buttons instead of the tiny native browser spinner, and a centered value. */
.stepper { display: flex; align-items: stretch; }
.step-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--chalk-muted);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.step-btn:hover { color: var(--chalk); border-color: var(--amber-dim); }
.step-btn:active { transform: scale(0.92); background: var(--amber); border-color: var(--amber); color: #fff; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ---------- league baseline ----------
   Most of the card is collapsed behind an Advanced toggle by default, so
   this is now a stacked column (header → toggle → summary or full panel)
   rather than the old side-by-side row. */
.league-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.league-bar-head h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
}
.league-bar-head .hint { margin: 0; }

/* Advanced toggle row */
.lg-toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: var(--chalk-muted);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--amber-dim); border-color: var(--amber); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--amber); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--amber-dim); outline-offset: 2px; }
.toggle-label { font-size: 13px; font-weight: 600; color: var(--chalk-muted); }

/* Collapsed summary line */
.league-default-display {
  font-size: 13px;
  color: var(--chalk-muted);
  padding: 2px 0 0;
}
.league-default-display strong { color: var(--chalk); }
.league-default-hint { font-size: 11px; color: var(--chalk-muted); opacity: 0.75; margin-left: 4px; }

/* Expanded panel */
.league-advanced { padding-top: 4px; }
.league-inputs {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.league-select-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.league-select-row .setting-input { flex: 1 1 160px; min-width: 140px; }
.league-select-row select {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--chalk);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 10px;
  height: 40px;
  width: 100%;
}
.league-select-row select:disabled { opacity: 0.5; }
.league-select-row select:focus { outline: none; border-color: var(--amber-dim); }
.btn.small { padding: 8px 14px; font-size: 12px; }

/* ---------- shared setting inputs (league avg, O/U line) ---------- */
.setting-input {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--chalk-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.setting-input span i { font-style: normal; opacity: 0.7; }
.setting-input .stepper {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-deep);
}
.setting-input .step-btn {
  width: 38px;
  height: 38px;
  font-size: 20px;
  background: var(--surface);
  border: none;
  border-radius: 0;
}
.setting-input .step-btn:active { background: var(--amber); color: #fff; }
.setting-input input {
  width: 72px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--chalk);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 4px;
  text-align: center;
}
.setting-input input:focus { outline: none; }

/* ---------- compute bar ---------- */
.compute-bar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}
.compute-bar .btn.primary { padding: 13px 34px; font-size: 15px; }

/* ---------- most likely score hero card ---------- */
.ps-hero {
  background: var(--surface-raised);
  border: 1px solid rgba(29, 177, 255, 0.25);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
  margin-bottom: 16px;
}
.ps-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--amber);
  opacity: 0.8;
  margin-bottom: 14px;
}
.ps-teams-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 14px;
}
.ps-team-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.ps-emblem { width: 64px; height: 74px; flex-shrink: 0; }
.ps-team {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-team.home { color: var(--home); }
.ps-team.away { color: var(--away); }
.ps-scoreline {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--chalk);
  letter-spacing: 3px;
  line-height: 1;
  flex-shrink: 0;
}
.ps-divider { height: 1px; background: var(--line); margin: 14px 0 10px; }
.ps-caption { font-size: 11px; color: var(--chalk-muted); letter-spacing: 0.5px; }
.xg-pill-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.xg-pill {
  background: rgba(29, 177, 255, 0.07);
  border: 1px solid rgba(29, 177, 255, 0.18);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 90px;
  text-align: center;
}
.xg-pill-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--chalk-muted);
  margin-bottom: 4px;
}
.xg-pill-val { font-size: 17px; font-weight: 800; color: var(--chalk); letter-spacing: 0.5px; }
.xg-pill-val.accent { color: var(--amber); }

/* ---------- results ---------- */

.engine-readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
}
@media (max-width: 680px) {
  .engine-readout { grid-template-columns: repeat(2, 1fr); }
}
.readout-item {
  background: var(--surface);
  padding: 14px 10px;
  text-align: center;
}
.readout-item.highlight { background: var(--surface-raised); }
.readout-item .label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--chalk-muted);
  margin-bottom: 6px;
}
.readout-item .value {
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--amber);
}
.readout-item .value.small {
  font-size: 13px;
  font-weight: 500;
  color: var(--chalk-muted);
}

.markets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
@media (max-width: 680px) {
  .markets-grid { grid-template-columns: 1fr; }
}
.market-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
}
.market-card h2 {
  font-family: var(--font-display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
  font-weight: 700;
}
.market-card h2 .muted { font-family: var(--font-mono); font-size: 11px; color: var(--chalk-muted); text-transform: none; letter-spacing: 0; }

/* ---------- 1X2 outcome tiles (ported from ScoreMatrix) ---------- */
.outcome-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.o-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}
.o-tile::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.o-tile.home::before { background: var(--home); }
.o-tile.draw::before { background: var(--draw); }
.o-tile.away::before { background: var(--away); }
.o-tile.home { border-color: rgba(29, 177, 255, 0.25); }
.o-tile.draw { border-color: rgba(245, 200, 66, 0.25); }
.o-tile.away { border-color: rgba(255, 107, 53, 0.25); }
.o-tile-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--chalk-muted);
}
.o-tile-pct {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}
.o-tile.home .o-tile-pct { color: var(--home); }
.o-tile.draw .o-tile-pct { color: var(--draw); }
.o-tile.away .o-tile-pct { color: var(--away); }
.o-tile-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--chalk-muted);
  letter-spacing: 0.2px;
}

/* ---------- split pills: Over/Under and BTTS, each outcome standalone ----------
   Colored green at >=60% probability, red below 60% — independently per side,
   so e.g. "Over 71% / Under 29%" renders green + red, not paired opposites. */
.split-pill-row {
  display: flex;
  gap: 10px;
}
.split-pill {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.split-pill-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--chalk-muted);
  margin-bottom: 8px;
}
.split-pill-top b {
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}
.split-pill-bar {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
}
.split-pill-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.4s ease, background 0.2s ease;
  background: var(--bad);
}
.split-pill-tag {
  margin-top: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--chalk-muted);
  letter-spacing: 0.2px;
}
.split-pill.good .split-pill-top b { color: var(--good); }
.split-pill.good .split-pill-bar > span { background: var(--good); }
.split-pill.good .split-pill-tag { color: var(--good); }
.split-pill.bad .split-pill-top b { color: var(--bad); }
.split-pill.bad .split-pill-bar > span { background: var(--bad); }
.split-pill.bad .split-pill-tag { color: var(--bad); }

.top-scores {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-scores li {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg-deep);
  border-radius: 8px;
}
.top-scores li b { color: var(--amber); }

/* ---------- score matrix ---------- */
.matrix-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.matrix-section h2 {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.matrix-section h2 .muted { font-family: var(--font-mono); font-size: 11px; color: var(--chalk-muted); text-transform: none; }
.matrix-scroll { overflow-x: auto; margin-top: 12px; }
.matrix-table { border-collapse: collapse; font-family: var(--font-mono); font-size: 11px; }
.matrix-table th, .matrix-table td {
  width: 34px;
  height: 30px;
  text-align: center;
  border: 1px solid var(--bg-deep);
}
.matrix-table thead th {
  color: var(--away);
  font-weight: 600;
  background: var(--bg-deep);
}
.matrix-table tbody th {
  color: var(--home);
  font-weight: 600;
  background: var(--bg-deep);
}
.matrix-table td {
  color: var(--chalk);
  cursor: default;
}
.matrix-table td.peak {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
  font-weight: 700;
}

/* ---------- header stats strip: computed λ + Best Bet ----------
   Lives inline in the header row now, centered between the logo and the
   action buttons — one flat divided pill, label stacked over value, thin
   vertical hairlines between stats. Mirrors ScoreMatrix's header-center
   strip, including its narrow-screen fallback (a condensed duplicate strip
   docked under the header instead of squeezing into the row). */
.ss-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  flex: 1 1 auto;
  max-width: 460px;
  min-width: 0;
}
.ss-item {
  padding: 6px 12px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  position: relative;
  min-width: 0;
  border-left: 1px solid var(--line);
}
.ss-item:first-child { border-left: none; }
.ss-label {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--chalk-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ss-sym { text-transform: none; }
.ss-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--chalk);
}
.ss-value.home { color: var(--home); }
.ss-value.away { color: var(--away); }
.ss-value.bestbet {
  font-family: var(--font-body);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--draw);
  min-width: 0;
}
#ssBestBetLabel, #ssBestBetLabel-m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 90px; }
.bestbet-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--chalk-muted);
  flex-shrink: 0;
}
.bestbet-pct.good { color: var(--good); }
.bestbet-pct.bad { color: var(--bad); }

/* Mobile condensed duplicate strip — hidden on wider screens where the
   in-header .ss-panel already fits; shown below the header on narrow ones. */
.ss-panel-mobile {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.ss-panel-mobile .ss-item { padding: 8px 6px 9px; border-radius: 0; }
.ss-panel-mobile .ss-value.bestbet { font-size: 11px; }

@media (max-width: 720px) {
  .ss-panel { display: none; }
  .ss-panel-mobile { display: grid; }
  .site-head-row { justify-content: space-between; }
}
@media (max-width: 420px) {
  .ss-panel-mobile { grid-template-columns: 1fr 1fr; }
  .ss-panel-mobile .ss-item.ss-bestbet { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--line); }
}

/* ---------- Bet Summary: empty state ---------- */
.empty-state { padding: 40px 10px; text-align: center; }
.empty-state .hint { margin: 0; }

/* ---------- Match Verdict ---------- */
.verdict-card {
  background: linear-gradient(135deg, rgba(29, 177, 255, 0.06), rgba(29, 177, 255, 0));
}
.verdict-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
}
.verdict-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.verdict-label { font-size: 19px; font-weight: 800; color: var(--chalk); line-height: 1.2; }
.verdict-sub { font-size: 12px; color: var(--chalk-muted); margin-top: 3px; }
.verdict-pct-wrap { text-align: right; flex-shrink: 0; margin-left: auto; }
.verdict-pct { font-family: var(--font-mono); font-size: 28px; font-weight: 800; line-height: 1; }
.verdict-fair { font-size: 11px; color: var(--chalk-muted); margin-top: 3px; }

/* ---------- Signal Check ---------- */
.signal-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
}
.signal-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.signal-note { font-size: 12px; color: var(--chalk-muted); line-height: 1.6; margin-top: 8px; }

/* ---------- Quick Stats ---------- */
.quick-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.qstat-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-top: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.qstat-label {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--chalk-muted);
  margin-bottom: 5px;
}
.qstat-val { font-family: var(--font-mono); font-size: 20px; font-weight: 800; color: var(--chalk); line-height: 1; }
.qstat-sub { font-size: 11px; color: var(--chalk-muted); margin: 4px 0 7px; }
.qstat-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}

/* ---------- Match Log ---------- */
.ml-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ml-stats-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.ml-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ml-stat-val { font-family: var(--font-mono); font-size: 16px; font-weight: 800; }
.ml-stat-val.hit-val { color: var(--good); }
.ml-stat-val.miss-val { color: var(--bad); }
.ml-stat-val.rate-val { color: var(--amber); }
.ml-stat-label { font-size: 10px; color: var(--chalk-muted); letter-spacing: 0.5px; text-transform: uppercase; }
.ml-stat-divider { width: 1px; height: 22px; background: var(--line); }
.ml-empty { color: var(--chalk-muted); font-size: 13px; text-align: center; padding: 18px 0; margin: 0; }
.ml-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ml-entry:last-child { border-bottom: none; }
.ml-entry-main { flex: 1 1 160px; min-width: 140px; }
.ml-entry-fixture { font-size: 13px; font-weight: 700; color: var(--chalk); }
.ml-entry-meta { font-size: 11px; color: var(--chalk-muted); margin-top: 2px; }
.ml-entry-bet {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  background: rgba(29, 177, 255, 0.1);
  border: 1px solid rgba(29, 177, 255, 0.25);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}
.ml-entry-score {
  width: 84px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--chalk);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}
.ml-entry-score:focus { outline: none; border-color: var(--amber-dim); }
.ml-entry-outcome { font-size: 11px; font-weight: 700; white-space: nowrap; }
.ml-entry-outcome.hit { color: var(--good); }
.ml-entry-outcome.miss { color: var(--bad); }
.ml-entry-outcome.pending { color: var(--chalk-muted); }
.ml-entry-del {
  background: transparent;
  border: none;
  color: var(--chalk-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 4px 6px;
}
.ml-entry-del:hover { color: var(--bad); }
.ml-add-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---------- Calibration modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 15px; }
.calib-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.calib-row:last-child { border-bottom: none; }
.calib-market { font-size: 13px; font-weight: 700; color: var(--chalk); }
.calib-market-n { font-size: 11px; color: var(--chalk-muted); font-weight: 400; margin-left: 4px; }
.calib-scores { display: flex; gap: 16px; text-align: right; }
.calib-scores div { display: flex; flex-direction: column; align-items: flex-end; }
.calib-scores .cs-label { font-size: 10px; color: var(--chalk-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.calib-scores .cs-val { font-family: var(--font-mono); font-size: 14px; font-weight: 800; color: var(--chalk); }
.calib-empty { color: var(--chalk-muted); font-size: 13px; text-align: center; padding: 20px 0; }
.calib-note { font-size: 11px; color: var(--chalk-muted); line-height: 1.6; margin-top: 14px; }

/* ---------- Help tab ---------- */
.help-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.help-lede { color: var(--chalk-muted); font-size: 12px; line-height: 1.7; margin: 0 0 14px; }
.help-steps p { font-size: 13px; color: var(--chalk-muted); line-height: 1.75; margin: 0 0 10px; }
.help-steps p:last-child { margin-bottom: 0; }
.help-step-title { color: var(--chalk); font-weight: 700; }

/* ---------- FAQ / Help accordion ---------- */
.faq-item, .hg-item {
  border-left: 3px solid var(--amber);
  margin-bottom: 10px;
  background: var(--surface-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.faq-item:hover, .hg-item:hover { border-left-color: var(--away); }
.faq-q, .hg-q {
  font-size: 13px;
  font-weight: 700;
  color: var(--chalk);
  background: rgba(29, 177, 255, 0.08);
  cursor: pointer;
  padding: 13px 14px 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.faq-q:hover, .hg-q:hover { background: rgba(29, 177, 255, 0.15); }
.faq-item.open .faq-q, .hg-item.open .hg-q { background: rgba(29, 177, 255, 0.18); }
.faq-q::after, .hg-q::after {
  content: '▸';
  font-size: 12px;
  color: var(--amber);
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-item.open .faq-q::after, .hg-item.open .hg-q::after { transform: rotate(90deg); }
.faq-a, .hg-a {
  font-size: 12px;
  color: var(--chalk-muted);
  line-height: 1.75;
  padding: 0 16px;
  background: var(--surface);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border-top: 0 solid var(--line);
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.35s ease, border-top-width 0.35s ease;
}
.faq-item.open .faq-a, .hg-item.open .hg-a {
  max-height: 1200px;
  opacity: 1;
  padding: 12px 16px 14px;
  border-top-width: 1px;
}
.faq-a strong, .hg-a strong { color: var(--chalk); }
.faq-item.disclaimer { border-left-color: var(--bad); }
.faq-item.disclaimer .faq-q { color: var(--bad); }
.faq-item.contact { border-left-color: var(--good); }
.faq-item.contact .faq-q { color: var(--good); }
.contact-links { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}
.contact-links a.mail { color: var(--amber); }
.contact-links a.whatsapp { color: #25d366; }
.contact-links a.phone { color: var(--chalk-muted); }

/* ---------- footer ---------- */
.site-foot { margin-top: 50px; border-top: 1px solid var(--line); }
.site-foot .wrap { padding: 18px 20px; }
.site-foot p { margin: 0; color: var(--chalk-muted); font-size: 12px; }
