:root {
  --bg: #121418;
  --bg-2: #181c22;
  --card: #1c2129;
  --card-2: #222833;
  --line: #313844;
  --text: #f3f5f7;
  --muted: #8d97a5;
  --green: #1f8f4e;
  --green-2: #163d28;
  --green-ink: #e7ffef;
  --amber: #a87416;
  --amber-2: #3a2d14;
  --amber-ink: #fff4d8;
  --link: #3ddc97;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 500px at 10% -10%, #1d2633 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--link); }
button, a, input, select { }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.wrap { width: min(1180px, calc(100% - 28px)); margin: 0 auto; }
.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(18, 20, 24, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #262c35;
}
.mast { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0 4px; }
.brand-mark { color: var(--text); font-weight: 750; font-size: 1.15rem; text-decoration: none; letter-spacing: 0.01em; }
.site-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  background: var(--green-2);
  border: 1px solid #2f8a52;
  border-radius: 14px;
  padding: 4px;
}
.site-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--green-ink); text-decoration: none; font-weight: 650;
  padding: 8px 12px; border-radius: 10px;
}
.site-nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: white; background: var(--green); }
.brand-row { display: flex; justify-content: space-between; gap: 16px; align-items: end; padding: 8px 0 10px; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand strong, .brand h1 { font-size: 1.25rem; letter-spacing: 0.01em; margin: 0; }
.brand span, .note, .muted { color: var(--muted); }
.lede { color: #c5ced8; line-height: 1.6; font-size: 0.98rem; margin: 16px 0 4px; }
.explain { margin: 8px 0 4px; }
.explain details { border: 1px solid #2f8a52; border-radius: 12px; background: #163d28; }
.explain summary {
  cursor: pointer;
  color: var(--green-ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 12px;
  list-style: none;
}
.explain summary::-webkit-details-marker { display: none; }
.explain summary::before { content: "▸ "; }
.explain details[open] summary::before { content: "▾ "; }
.explain summary:hover { color: white; }
.explain-body { display: none; padding: 0 12px 8px; color: #c5ced8; line-height: 1.6; font-size: 0.98rem; }
.explain details[open] .explain-body { display: block; }
.explain p { margin: 0 0 10px; }
.explain strong { color: var(--text); }
h1 { font-size: 1.5rem; font-weight: 700; margin: 8px 0; }
h1.brand-mark { font-size: 1.15rem; font-weight: 750; margin: 0; letter-spacing: 0.01em; }
h1.brand-mark a { color: var(--text); text-decoration: none; }
.skip {
  position: absolute; left: 8px; top: -40px; z-index: 20;
  background: var(--green); color: white; padding: 8px 12px; border-radius: 8px;
}
.skip:focus { top: 8px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding-bottom: 12px; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--muted); }
.controls .status { margin: 0 0 9px auto; }
input, select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
}
.seg { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; min-height: 38px; }
.seg button, .chip, .text-btn, .add-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; color: var(--muted); line-height: 1; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: #243041; color: var(--text); }
.controls .text-btn { min-height: 38px; display: inline-flex; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: #171b21;
}
.chip[aria-pressed="true"] { color: var(--green-ink); border-color: #2d6b49; background: var(--green-2); }
.chip:disabled { opacity: 0.45; cursor: default; }
.text-btn { color: var(--muted); text-decoration: underline; padding: 0; }
.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 0 40px;
}
.card {
  background: linear-gradient(180deg, var(--card) 0%, #191e26 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 196px;
}
.card:hover { border-color: #445066; }
.card-head, .teams, .market, .card-foot { display: flex; align-items: center; }
.card-head, .card-foot { justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.82rem; }
.teams { flex-direction: column; align-items: stretch; gap: 6px; }
.team { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.badge-img, .badge-fallback {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: contain; background: #11151b; flex: 0 0 auto;
}
.badge-fallback { display: inline-grid; place-items: center; font-size: 0.65rem; color: var(--muted); border: 1px solid var(--line); }
.markets { display: flex; flex-direction: column; gap: 6px; }
.market {
  gap: 8px;
  background: rgba(255,255,255,0.02);
  border-radius: 9px;
  padding: 6px 8px;
  justify-content: space-between;
}
.market .label { flex: 1; font-size: 0.92rem; }
.hit, .odds { border: 0; border-radius: 999px; }
.hit {
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.hit.green { background: var(--green); color: white; }
.hit.amber { background: var(--amber); color: #1b1406; }
.odds { font-weight: 800; min-width: 3.2rem; text-align: right; background: transparent; }
.book { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 500; text-align: right; }
.insight, .sel.unpriced .odds { color: var(--muted); font-size: 0.75rem; font-weight: 600; line-height: 1.35; }
.build { color: var(--link); font-weight: 700; text-decoration: none; }
.build:hover { text-decoration: underline; }
.empty, .error, .banner {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
  margin: 16px 0;
}
.error { border-style: solid; color: #ffd7d7; }
.banner { background: #2a2416; color: var(--amber-ink); border-style: solid; border-color: #6d5420; }
.state-pill { border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; }

dialog {
  width: min(760px, calc(100% - 24px));
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,0.62); }
.dialog-head, .dialog-body { padding: 14px 16px; }
.dialog-body { max-height: 70vh; overflow: auto; }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.dialog-head button { background: transparent; border: 0; color: var(--text); cursor: pointer; font-size: 1.2rem; }
.switch { display: flex; gap: 6px; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid #2a313b; }
th { color: var(--muted); font-weight: 600; }
.yes { color: #8dffa8; } .no { color: #ffb4a8; }

.page-head { padding: 18px 0 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.explorer { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; }
.sel {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(6, minmax(70px, 0.7fr)) auto auto;
  gap: 6px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}
.slip {
  position: sticky; bottom: 0;
  background: #141920;
  border-top: 1px solid var(--line);
  padding: 10px 0 16px;
}
.slip ul { margin: 8px 0; padding-left: 18px; }
.add-btn { color: var(--link); }
.nav-link { color: var(--link); font-weight: 700; text-decoration: none; }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.perf-grid div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.perf-grid span { display: block; color: var(--muted); font-size: 0.75rem; }
.perf-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.perf-row { padding: 12px; }
.result { border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; }
.result.win { background: var(--green); color: white; }
.result.loss { background: #7a2e2e; color: white; }
.result.void, .result.pending, .result.unverifiable { background: var(--amber-2); color: var(--amber-ink); }
.method { color: var(--muted); padding-bottom: 28px; }
.method h2 { color: var(--text); font-size: 1.1rem; }
.pnl-pos { color: #8dffa8; }
.pnl-neg { color: #ff8f8f; }
.pnl-zero { color: var(--muted); }
.chart-title { margin: 8px 0 0; font-size: 1.05rem; }
#perf-chart { width: 100%; margin: 8px 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.prose { padding: 8px 0 28px; line-height: 1.65; color: #c5ced8; }
.prose h2 { color: var(--text); font-size: 1.12rem; margin: 1.3rem 0 0.4rem; }
.prose ul { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.site-footer { border-top: 1px solid #262c35; padding: 22px 0 40px; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; }
.site-footer a { color: var(--link); text-decoration: none; font-weight: 650; }
.site-footer p { margin: 0; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 12px 0 28px; }
.login-form button { background: var(--green); color: white; border: 0; border-radius: 8px; min-height: 40px; cursor: pointer; font-weight: 700; }

@media (max-width: 860px) {
  .board, .perf-list { grid-template-columns: 1fr; }
  .mast, .brand-row { flex-direction: column; align-items: flex-start; }
  .controls .status { margin-left: 0; }
  .seg { flex: 1 0 100%; }
  .seg button { flex: 1; }
  .sel { grid-template-columns: 1fr 1fr; }
  .sel .wide { grid-column: 1 / -1; }
}
