/* ================================================================
   SportsFathom — the free odds calculators (/tools, backend/api/tools_pages.py)

   A light page of its own: the site's colours (styles.css :root) without
   the app shell, so a calculator opens fast on a phone. System fonts only:
   no web font to wait for. Phone first; a 390 px screen gets one column,
   16 px gutters and no sideways scroll (wide tables scroll inside their
   own box).
   ================================================================ */
:root {
  --bg: #0a0d12;
  --surface: #12161f;
  --surface-2: #1a1f2b;
  --line: #2b3342;
  --text: #eef1f7;
  --muted: #9aa5b6;
  --grass: #53d337;
  --grass-bright: #7bec5c;
  --clay: #ffb43d;
  --live: #ff5461;
  --ring: 0 0 0 3px rgba(83, 211, 55, .28);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
}
a { color: var(--grass-bright); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: 6px;
}
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- header and the calculators' nav ---- */
.tl-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  max-width: 920px; margin: 0 auto;
}
.tl-brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px;
}
.tl-brand i { font-style: normal; color: var(--grass); }
.tl-mark { flex: none; border-radius: 6px; }
.tl-open {
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text);
}
.tl-open:hover { border-color: var(--grass); }
.tl-nav {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px;
  max-width: 920px; margin: 0 auto; scrollbar-width: thin;
}
.tl-nav a {
  flex: none; font-size: 14px; text-decoration: none; color: var(--muted);
  padding: 6px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); white-space: nowrap;
}
.tl-nav a[aria-current="page"] { color: var(--bg); background: var(--grass); border-color: var(--grass); font-weight: 600; }

/* ---- the page ---- */
.tl-main { max-width: 920px; margin: 0 auto; padding: 4px 16px 32px; }
.tl-crumb { font-size: 13px; color: var(--muted); margin: 6px 0 2px; }
.tl-crumb a { color: var(--muted); }
h1 { font-size: 28px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -.01em; }
h2 { font-size: 19px; line-height: 1.3; margin: 26px 0 8px; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 64ch; }
.ex p, .ex li { max-width: 70ch; }
.formulas { padding-left: 20px; font-family: var(--mono); font-size: 14px; }
.formulas li { margin: 4px 0; }

/* ---- a calculator ---- */
.calc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 0 0 8px;
}
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.calc-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld span { font-size: 13px; color: var(--muted); font-weight: 600; }
.fld input, .fld select {
  width: 100%; min-width: 0; font: 600 18px/1.3 var(--mono); color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; min-height: 46px;
}
.fld select { font: 500 15px/1.3 var(--font); }
.fld input[aria-invalid="true"] { border-color: var(--live); }
.fld-fmt { flex: 1 1 200px; }
.fld-stake { flex: 0 1 140px; }
.seg { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; flex: 1 1 100%; }
.seg legend { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0; margin-bottom: 4px; }
.seg label { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; min-height: 32px; }
.seg input { accent-color: var(--grass); width: 18px; height: 18px; }
.legs { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
div.legs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
ol.legs .leg { display: flex; align-items: center; gap: 8px; }
ol.legs .leg input {
  flex: 1; min-width: 0; font: 600 18px/1.3 var(--mono); color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; min-height: 46px;
}
ol.legs .leg input[aria-invalid="true"] { border-color: var(--live); }
.leg-n {
  flex: none; width: 26px; text-align: center; font: 600 14px var(--mono); color: var(--muted);
}
.leg-x, .btn-ghost {
  font: 600 15px var(--font); color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.leg-x { flex: none; width: 44px; height: 44px; font-size: 20px; line-height: 1; }
.leg-x:disabled { opacity: .35; cursor: default; }
.btn-ghost { padding: 10px 14px; min-height: 44px; }
.btn-ghost:hover:not(:disabled), .leg-x:hover:not(:disabled) { border-color: var(--grass); }
.btn-ghost:disabled { opacity: .45; cursor: default; }
.hint { font-size: 13px; color: var(--muted); }
.calc-err { color: var(--live); font-weight: 600; margin: 10px 0 0; }
.calc-line { margin: 12px 0 0; }
.calc-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ---- answers ---- */
.res { margin-top: 14px; }
.res-big {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
}
.res-k { font-size: 13px; color: var(--muted); font-weight: 600; flex-basis: 100%; }
.res-big b { font: 700 30px/1.15 var(--mono); color: var(--clay); }
.res-s { font-size: 14px; color: var(--muted); }
/* a long parlay's odds run to dozens of digits: they break onto the next line
   rather than push the page sideways on a phone */
.res-big b, .res-s { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.res-list { margin: 10px 0 0; display: grid; gap: 6px; }
.res-list div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.res-list dt { color: var(--muted); flex: 1 1 10em; }
/* beside its label while it fits, on a line of its own when it does not, and
   broken anywhere only when it is wider than the line (a huge payout) */
.res-list dd { margin: 0 0 0 auto; font: 600 16px var(--mono); text-align: right; max-width: 100%; overflow-wrap: anywhere; }

/* ---- tables (they scroll in their own box on a narrow screen) ---- */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: 15px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
td { font-family: var(--mono); }
.res-table td b { color: var(--clay); }
thead th { white-space: normal; }
/* a phone: the no-vig table keeps its four main columns on the screen (the
   decimal price is in the converter, and on a wider screen) */
@media (max-width: 479px) {
  th, td { padding: 8px 6px; font-size: 14px; }
  .res-table .col-dec { display: none; }
  table { min-width: 0; }
}

/* ---- the hub's list ---- */
.tl-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tl-card a {
  display: block; padding: 16px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.tl-card a:hover { border-color: var(--grass); }
.tl-card b { display: block; font-size: 18px; margin-bottom: 4px; color: var(--grass-bright); }
.tl-card span { color: var(--muted); font-size: 15px; }

/* ---- links, responsible gambling, footer ---- */
.tl-related { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--line); }
.tl-related ul { padding-left: 20px; }
.tl-rg {
  margin-top: 24px; font-size: 14px; color: var(--muted);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
}
.tl-foot {
  max-width: 920px; margin: 0 auto; padding: 16px 16px 40px; font-size: 14px; color: var(--muted);
  border-top: 1px solid var(--line);
}
.tl-foot a { color: var(--muted); }

@media (min-width: 640px) {
  .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc { padding: 20px; }
  h1 { font-size: 34px; }
  .res-list div { padding: 6px 2px; }
}
@media (min-width: 860px) {
  [data-calc="converter"] .calc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [data-calc="breakeven"] .calc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tl-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .tl-nav a, .tl-card a, .tl-open, .btn-ghost { transition: border-color .15s ease, background .15s ease; }
}
