/* TrainYourOdds: the reference book on the shelf. Bottle green, brass and paper, a serif for
   titles (Source Serif 4, weight 600, served from this site) and the visitor's own system font
   for everything else. The colour tokens below are copied from src/brand.js, and
   test/brand.test.js fails the build if the two ever differ. Every text colour reads at 4.5 to 1
   or more on its background. No inline styles are used anywhere, and the checker keeps it so. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-600-latin-v15.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-600-greek-v15.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* ---- Tokens: light (the default), then dark by choice or by the visitor's setting ---- */
:root {
  --ty-page: #f6f7f4;
  --ty-card: #ffffff;
  --ty-surface: #eef1ec;
  --ty-ink: #16211b;
  --ty-muted: #4f5c54;
  --ty-line: #d9ded6;
  --ty-line-strong: #aab3a9;
  --ty-field: #7d887f;
  --ty-accent: #1f4d3a;
  --ty-on-accent: #f6f7f4;
  --ty-link: #1f4d3a;
  --ty-brass: #a8842c;
  --ty-brass-ink: #7a5d16;
  --ty-jackpot: #f5eedb;
  --ty-chart: #2e6b52;
  --ty-warn-ink: #7a4f00;
  --ty-warn-bg: #fff1cc;
  --ty-header-rule: #aab3a9;
  --ty-footer: #1f4d3a;
  --ty-footer-ink: #f6f7f4;
  --ty-footer-muted: #c9d6cd;
  --ty-footer-brass: #dcbd6e;
  --ty-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ty-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ty-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ty-radius: 4px;
  --ty-wide: 68rem;
  --ty-read: 44rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ty-page: #0f1512;
  --ty-card: #16201b;
  --ty-surface: #121a16;
  --ty-ink: #eef1ec;
  --ty-muted: #a9b5ad;
  --ty-line: #2a3830;
  --ty-line-strong: #435349;
  --ty-field: #6b7a70;
  --ty-accent: #8cc7a8;
  --ty-on-accent: #0f1512;
  --ty-link: #9fd3b6;
  --ty-brass: #d1ad55;
  --ty-brass-ink: #d1ad55;
  --ty-jackpot: #2a2513;
  --ty-chart: #6fb592;
  --ty-warn-ink: #ffd27a;
  --ty-warn-bg: #3a2f14;
  --ty-header-rule: #34443a;
  --ty-footer: #0b100d;
  --ty-footer-ink: #eef1ec;
  --ty-footer-muted: #a9b5ad;
  --ty-footer-brass: #d1ad55;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ty-page: #0f1512;
    --ty-card: #16201b;
    --ty-surface: #121a16;
    --ty-ink: #eef1ec;
    --ty-muted: #a9b5ad;
    --ty-line: #2a3830;
    --ty-line-strong: #435349;
    --ty-field: #6b7a70;
    --ty-accent: #8cc7a8;
    --ty-on-accent: #0f1512;
    --ty-link: #9fd3b6;
    --ty-brass: #d1ad55;
    --ty-brass-ink: #d1ad55;
    --ty-jackpot: #2a2513;
    --ty-chart: #6fb592;
    --ty-warn-ink: #ffd27a;
    --ty-warn-bg: #3a2f14;
    --ty-header-rule: #34443a;
    --ty-footer: #0b100d;
    --ty-footer-ink: #eef1ec;
    --ty-footer-muted: #a9b5ad;
    --ty-footer-brass: #d1ad55;
    color-scheme: dark;
  }
}

/* ---- Base ------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--ty-page); color: var(--ty-ink); font: 1.0625rem/1.6 var(--ty-sans); }
body > main { flex: 1 0 auto; }
a { color: var(--ty-link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ty-brass); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1, h2 { font-family: var(--ty-serif); font-weight: 600; letter-spacing: -0.01em; }
h1 { margin: 0.3rem 0 0.9rem; font-size: clamp(2rem, 1.35rem + 2.6vw, 3rem); }
h2 { margin: 2.8rem 0 0.9rem; font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.7rem); }
h3 { margin: 1.6rem 0 0.4rem; font-size: 1.1rem; font-weight: 650; }
p, li { max-width: var(--ty-read); }
code { font-family: var(--ty-mono); font-size: 0.92em; }
strong { font-weight: 650; }
[hidden] { display: none !important; }
.ty-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ty-skip { position: absolute; left: 1rem; top: -4rem; z-index: 50; padding: 0.5rem 0.8rem; background: var(--ty-card); color: var(--ty-ink); border: 1px solid var(--ty-line-strong); border-radius: var(--ty-radius); }
.ty-skip:focus { top: 1rem; }
.ty-kicker { display: block; color: var(--ty-muted); font-size: 0.95rem; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: 0.08em; }

/* ---- Header: paper, with a double rule like a book's title page --------------------- */
.ty-header { position: relative; z-index: 20; background: var(--ty-page); border-bottom: 3px double var(--ty-header-rule); }
.ty-header .ty-bar { display: flex; align-items: center; gap: 0.5rem 1.25rem; max-width: var(--ty-wide); min-height: 4rem; margin: 0 auto; padding: 0.5rem 1rem; }
.ty-brand { display: inline-flex; align-items: center; gap: 0.6rem; margin-right: auto; color: var(--ty-ink); font-family: var(--ty-serif); font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.ty-logo { width: 2rem; height: 2rem; flex: none; }
.ty-menu-button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.8rem; border: 1px solid var(--ty-line-strong); border-radius: var(--ty-radius); background: var(--ty-card); color: var(--ty-ink); font: inherit; font-size: 0.95rem; cursor: pointer; }
.ty-burger, .ty-burger::before, .ty-burger::after { display: block; width: 1rem; height: 2px; background: currentColor; border-radius: 1px; }
.ty-burger { position: relative; }
.ty-burger::before, .ty-burger::after { content: ""; position: absolute; left: 0; }
.ty-burger::before { top: -5px; }
.ty-burger::after { top: 5px; }
/* The menu: a popover panel on a phone, opened by the button without any script. */
.ty-menu { margin: 0; padding: 0; border: 0; color: var(--ty-ink); }
.ty-menu:popover-open { position: fixed; inset: 4.3rem 0.75rem auto auto; width: min(19rem, calc(100vw - 1.5rem)); display: flex; flex-direction: column; gap: 1rem; padding: 1rem 1.1rem 1.2rem; border: 1px solid var(--ty-line-strong); border-radius: var(--ty-radius); background: var(--ty-card); box-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.35); }
.ty-menu::backdrop { background: rgb(0 0 0 / 0.25); }
.ty-nav { display: flex; flex-direction: column; gap: 0.15rem; margin: 0; padding: 0; list-style: none; font-size: 1.05rem; }
.ty-nav li { max-width: none; }
.ty-nav a { display: block; padding: 0.35rem 0; color: var(--ty-ink); text-decoration: none; }
.ty-nav a:hover { color: var(--ty-link); }
.ty-nav a[aria-current] { text-decoration: underline; text-decoration-color: var(--ty-brass); text-decoration-thickness: 2px; text-underline-offset: 0.45em; }
.ty-bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.ty-search-link { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0.55rem 0.25rem 0.7rem; border: 1px solid var(--ty-line-strong); border-radius: 999px; color: var(--ty-muted); font-size: 0.9rem; text-decoration: none; }
.ty-search-link:hover { color: var(--ty-ink); border-color: var(--ty-field); }
.ty-search-link kbd { padding: 0 0.3rem; border: 1px solid var(--ty-line); border-radius: 3px; font: 0.72rem var(--ty-mono); color: var(--ty-muted); }
.ty-search-icon { position: relative; width: 0.8rem; height: 0.8rem; border: 1.6px solid currentColor; border-radius: 50%; }
.ty-search-icon::after { content: ""; position: absolute; right: -0.3rem; bottom: -0.25rem; width: 0.35rem; height: 1.6px; background: currentColor; transform: rotate(45deg); }
.ty-lang { padding: 0.2rem 0.7rem; border: 1px solid var(--ty-line-strong); border-radius: 999px; color: var(--ty-muted); font-size: 0.9rem; text-decoration: none; }
.ty-lang:hover { color: var(--ty-ink); }
.ty-theme { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.25rem 0.7rem; border: 1px solid var(--ty-line-strong); border-radius: 999px; background: transparent; color: var(--ty-muted); font: inherit; font-size: 0.9rem; cursor: pointer; }
.ty-theme:hover { color: var(--ty-ink); border-color: var(--ty-field); }
.ty-theme::before { content: ""; width: 0.85rem; height: 0.85rem; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
/* A wider screen shows the menu in the bar, and no button. So does a browser without popovers. */
@media (min-width: 60rem) {
  .ty-menu-button { display: none; }
  .ty-menu, .ty-menu:popover-open { position: static; inset: auto; width: auto; display: flex; flex-direction: row; align-items: center; gap: 1.5rem; padding: 0; border: 0; background: none; box-shadow: none; overflow: visible; }
  .ty-nav { flex-direction: row; gap: 1.25rem; font-size: 0.98rem; }
  .ty-nav a { padding: 0; color: var(--ty-muted); }
  .ty-nav a:hover, .ty-nav a[aria-current] { color: var(--ty-ink); }
}
@supports not selector(:popover-open) {
  .ty-header .ty-bar { flex-wrap: wrap; }
  .ty-menu-button { display: none; }
  .ty-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }
  .ty-nav { flex-direction: row; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
}

/* ---- Page ------------------------------------------------------------------------ */
.ty-page { width: 100%; max-width: var(--ty-wide); margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.ty-crumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; color: var(--ty-muted); font-size: 0.9rem; }
.ty-crumbs a { color: var(--ty-muted); }
.ty-lead { max-width: var(--ty-read); font-size: 1.2rem; color: var(--ty-ink); }
.ty-note, .ty-quiet { color: var(--ty-muted); font-size: 0.95rem; }
.ty-facts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.ty-facts li { padding: 0.2rem 0.75rem; border: 1px solid var(--ty-line); border-radius: 999px; background: var(--ty-card); font-size: 0.93rem; font-variant-numeric: tabular-nums; }
.ty-prose { max-width: var(--ty-read); }
.ty-prose > p:first-of-type, .ty-prose > .ty-lead { margin-top: 0; }

/* ---- Odds tables ------------------------------------------------------------------ */
.ty-table-wrap { overflow-x: auto; margin: 0.5rem 0; border: 1px solid var(--ty-line); border-radius: var(--ty-radius); background: var(--ty-card); }
.ty-odds { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ty-odds th, .ty-odds td { padding: 0.62rem 0.85rem; text-align: left; border-bottom: 1px solid var(--ty-line); white-space: nowrap; }
.ty-odds thead th { background: var(--ty-surface); color: var(--ty-muted); font-size: 0.95rem; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: 0.06em; border-bottom-color: var(--ty-line-strong); }
.ty-odds tbody th { font-weight: 600; }
.ty-odds tbody tr:hover { background: var(--ty-surface); }
.ty-odds .ty-prize { white-space: normal; min-width: 7rem; }
.ty-odds .ty-jackpot, .ty-odds tbody .ty-jackpot:hover { background: var(--ty-jackpot); }
.ty-odds .ty-jackpot .ty-chance { color: var(--ty-brass-ink); font-weight: 700; }
.ty-odds tfoot th, .ty-odds td:empty { border-bottom: 0; }
.ty-odds tfoot th, .ty-odds tfoot td { border-bottom: 0; border-top: 1px solid var(--ty-line-strong); font-weight: 650; }
@media (max-width: 30rem) {
  .ty-odds { font-size: 0.9rem; }
  .ty-odds th, .ty-odds td { padding: 0.5rem 0.4rem; white-space: normal; hyphens: auto; }
  .ty-odds thead th { letter-spacing: 0; font-size: 0.85rem; }
  .ty-odds .ty-chance { white-space: nowrap; }
  .ty-odds .ty-prize { min-width: 0; }
}

/* ---- Tools: a form, then the result it computes ------------------------------------- */
.ty-tool { margin: 1.75rem 0 0; padding: 1.1rem 1.25rem 0.6rem; border: 1px solid var(--ty-line); border-top: 3px solid var(--ty-accent); border-radius: var(--ty-radius); background: var(--ty-card); }
.ty-tool h2 { margin-top: 0.1rem; }
.ty-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.5rem 1.5rem; }
.ty-field label { display: block; margin-bottom: 0.3rem; font-weight: 600; }
.ty-field input, .ty-form select { width: 100%; max-width: 16rem; padding: 0.55rem 0.7rem; border: 1px solid var(--ty-field); border-radius: var(--ty-radius); background: var(--ty-page); color: var(--ty-ink); font: inherit; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.ty-form select { max-width: 22rem; font-size: 1rem; }
.ty-field input:focus-visible, .ty-form select:focus-visible { outline: 3px solid var(--ty-brass); outline-offset: 1px; }
.ty-hint { margin: 0.35rem 0 0.6rem; color: var(--ty-muted); font-size: 0.9rem; }
.ty-form > .ty-hint { grid-column: 1 / -1; }
.ty-result { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--ty-line); font-variant-numeric: tabular-nums; }
.ty-big { font-size: 1.25rem; }
.ty-big strong { color: var(--ty-brass-ink); font-family: var(--ty-serif); font-size: 1.6rem; font-weight: 600; }
.ty-verdict { font-weight: 650; }
.ty-warn { color: var(--ty-warn-ink); font-weight: 600; }
.ty-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; grid-column: 1 / -1; margin: 0.5rem 0 0.7rem; }
.ty-actions button, .ty-moves button { padding: 0.6rem 1.15rem; border: 1px solid var(--ty-accent); border-radius: var(--ty-radius); background: var(--ty-accent); color: var(--ty-on-accent); font: inherit; font-weight: 650; cursor: pointer; }
.ty-actions button:hover { filter: brightness(1.12); }
.ty-actions button:disabled { opacity: 0.6; cursor: progress; }
.ty-actions progress { width: 12rem; max-width: 100%; height: 0.6rem; accent-color: var(--ty-accent); }
.ty-result .ty-table-wrap { margin: 1rem 0; }

/* ---- Cards, steps and the small print ------------------------------------------------ */
.ty-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.75rem; margin: 0.75rem 0; padding: 0; list-style: none; }
.ty-cards li { max-width: none; }
.ty-cards a { display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: 0.95rem 1.05rem; border: 1px solid var(--ty-line); border-radius: var(--ty-radius); background: var(--ty-card); color: var(--ty-ink); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.ty-cards a:hover { border-color: var(--ty-accent); transform: translateY(-1px); }
.ty-cards strong { color: var(--ty-link); font-family: var(--ty-serif); font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.ty-cards span { color: var(--ty-muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.ty-steps { padding-left: 1.3rem; }
.ty-steps li { margin: 0.55rem 0; }
.ty-checked ul { padding-left: 1.3rem; }
.ty-disclaimer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--ty-line); color: var(--ty-muted); font-size: 0.9rem; }
.ty-snippet { overflow-x: auto; padding: 0.75rem; border: 1px solid var(--ty-line); border-radius: var(--ty-radius); background: var(--ty-surface); color: var(--ty-ink); font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; }
details > summary { cursor: pointer; }

/* ---- Footer: the book's green cloth --------------------------------------------------- */
.ty-footer { margin-top: 2rem; padding: 3rem 0 1.5rem; background: var(--ty-footer); color: var(--ty-footer-muted); font-size: 0.95rem; }
.ty-footer a { color: var(--ty-footer-ink); text-underline-offset: 0.2em; }
.ty-footer-grid { display: grid; gap: 2rem; max-width: var(--ty-wide); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 48rem) { .ty-footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.ty-footer p { margin: 0 0 0.6rem; }
.ty-footer ul { margin: 0; padding: 0; list-style: none; }
.ty-footer li { margin: 0.35rem 0; }
.ty-footer-name { display: flex; align-items: center; gap: 0.6rem; color: var(--ty-footer-ink); font-family: var(--ty-serif); font-size: 1.3rem; font-weight: 600; }
.ty-footer-name .ty-logo { outline: 1px solid color-mix(in srgb, var(--ty-footer-ink) 30%, transparent); border-radius: 4px; }
.ty-footer-promise { max-width: 26rem; color: var(--ty-footer-ink); font-family: var(--ty-serif); font-size: 1.2rem; font-weight: 600; line-height: 1.35; }
.ty-footer-title { color: var(--ty-footer-brass); font-weight: 650; font-variant-caps: all-small-caps; letter-spacing: 0.08em; font-size: 1.05rem; }
.ty-safety { max-width: var(--ty-wide); margin: 2.25rem auto 0; padding: 0 1rem; }
.ty-safety-inner { padding: 1.1rem 1.25rem 0.8rem; border: 1px solid color-mix(in srgb, var(--ty-footer-ink) 22%, transparent); border-left: 4px solid var(--ty-footer-brass); border-radius: var(--ty-radius); }
.ty-safety-inner p, .ty-safety-inner li { max-width: 60rem; }
.ty-safety-inner ul { display: grid; gap: 0.2rem 2rem; }
@media (min-width: 60rem) { .ty-safety-inner ul { grid-template-columns: repeat(3, 1fr); } }
.ty-footer .ty-footer-small { width: calc(100% - 2rem); max-width: calc(var(--ty-wide) - 2rem); margin: 1.5rem auto 0; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--ty-footer-ink) 18%, transparent); font-size: 0.85rem; }

/* ---- Charts drawn by the tools ----------------------------------------------------------- */
.ty-chart { margin: 1rem 0; }
.ty-chart svg { display: block; width: 100%; height: auto; background: var(--ty-card); border: 1px solid var(--ty-line); border-radius: var(--ty-radius); }
.ty-chart .ty-axis { stroke: var(--ty-muted); stroke-width: 1; }
.ty-chart .ty-guide { stroke: var(--ty-muted); stroke-width: 1; stroke-dasharray: 4 4; }
.ty-chart .ty-guide-target { stroke: var(--ty-brass-ink); }
.ty-chart .ty-tick { fill: var(--ty-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ty-chart .ty-curves polyline { fill: none; stroke: var(--ty-chart); stroke-width: 1.4; stroke-opacity: 0.75; stroke-linejoin: round; }

/* ---- The blackjack trainer and its chart -------------------------------------------------- */
.ty-felt { margin: 0.8rem 0; padding: 0.9rem 1.1rem; border-radius: var(--ty-radius); background: #1f4d3a; color: #f6f7f4; }
.ty-felt .ty-quiet { display: inline-block; min-width: 4.5rem; color: #c9d6cd; }
.ty-felt p { margin: 0.35rem 0; }
.ty-card { display: inline-block; min-width: 2.6rem; padding: 0.3rem 0.45rem; border-radius: 0.35rem; background: #ffffff; color: #16211b; font-size: 1.2rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.ty-card.ty-red { color: #b3261e; }
.ty-moves button { min-width: 7rem; }
.ty-chart-table caption { padding: 0.5rem 0.8rem; text-align: left; font-weight: 650; }
.ty-chart-table th, .ty-chart-table td { padding: 0.35rem 0.4rem; text-align: center; }
.ty-code { font-weight: 650; font-size: 0.9rem; }
.ty-code-H { background: #fbe3e3; color: #7a1d1d; }
.ty-code-S { background: #e2f1e8; color: #12452b; }
.ty-code-D, .ty-code-Ds { background: #fdf0cf; color: #6b4a00; }
.ty-code-P, .ty-code-Ph { background: #e1ecfb; color: #173f73; }
.ty-code-Rh, .ty-code-Rs, .ty-code-Rp { background: #ece6fb; color: #3d2a73; }
:root[data-theme="dark"] .ty-code-H { background: #4a1f1f; color: #ffd4d4; }
:root[data-theme="dark"] .ty-code-S { background: #173a27; color: #c8f0d6; }
:root[data-theme="dark"] .ty-code-D, :root[data-theme="dark"] .ty-code-Ds { background: #45360e; color: #ffe7a6; }
:root[data-theme="dark"] .ty-code-P, :root[data-theme="dark"] .ty-code-Ph { background: #1c2f4d; color: #cfe0ff; }
:root[data-theme="dark"] .ty-code-Rh, :root[data-theme="dark"] .ty-code-Rs, :root[data-theme="dark"] .ty-code-Rp { background: #2f2650; color: #e2d8ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ty-code-H { background: #4a1f1f; color: #ffd4d4; }
  :root:not([data-theme="light"]) .ty-code-S { background: #173a27; color: #c8f0d6; }
  :root:not([data-theme="light"]) .ty-code-D, :root:not([data-theme="light"]) .ty-code-Ds { background: #45360e; color: #ffe7a6; }
  :root:not([data-theme="light"]) .ty-code-P, :root:not([data-theme="light"]) .ty-code-Ph { background: #1c2f4d; color: #cfe0ff; }
  :root:not([data-theme="light"]) .ty-code-Rh, :root:not([data-theme="light"]) .ty-code-Rs, :root:not([data-theme="light"]) .ty-code-Rp { background: #2f2650; color: #e2d8ff; }
}
.ty-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.4rem 1rem; margin: 1rem 0; }
.ty-legend div { display: flex; gap: 0.6rem; align-items: baseline; }
.ty-legend dt { flex: 0 0 2.4rem; padding: 0.1rem 0; border-radius: 0.3rem; text-align: center; }
.ty-legend dd { margin: 0; font-size: 0.95rem; }

/* ---- Embeds, share block, the data story ------------------------------------------------- */
.ty-embed .ty-page { padding-top: 0.5rem; }
.ty-embed h1 { font-size: 1.35rem; }
.ty-share { margin-top: 1rem; }
.ty-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; list-style: none; padding: 0; margin: 1rem 0; }
.ty-stats li { max-width: none; background: var(--ty-card); border: 1px solid var(--ty-line); border-radius: var(--ty-radius); padding: 0.7rem 0.9rem; }
.ty-stats span { display: block; font-size: 0.85rem; color: var(--ty-muted); }
.ty-stats strong { font-family: var(--ty-serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ty-figure { margin: 1rem 0; }
.ty-figure figcaption { font-weight: 600; margin-bottom: 0.5rem; }
.ty-bars { width: 100%; height: auto; max-width: 40rem; display: block; }
.ty-bars .ty-bar { fill: var(--ty-chart); }
.ty-bars g:hover .ty-bar { opacity: 0.8; }
.ty-bar-label { fill: var(--ty-ink); font-size: 14px; }
.ty-bar-value { fill: var(--ty-muted); font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---- The rule check's notice: an official page behind the figures changed ------------------- */
.ty-stale { max-width: var(--ty-wide); margin: 1rem auto 0; padding: 0 1rem; }
.ty-stale p { max-width: none; margin: 0; padding: 0.75rem 1rem; border-left: 4px solid var(--ty-brass); background: var(--ty-warn-bg); border-radius: var(--ty-radius); color: var(--ty-ink); }

/* ---- Motion: page-to-page cross-fade where the browser supports it, none if asked ------------ */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---- Print: the page's content, in black on white ------------------------------------------- */
@media print {
  :root { --ty-page: #ffffff; --ty-card: #ffffff; --ty-ink: #000000; --ty-muted: #333333; --ty-link: #000000; }
  .ty-header, .ty-footer, .ty-noprint, .ty-crumbs, .ty-related, .ty-skip, .ty-actions, .ty-theme, .ty-share, form { display: none !important; }
  .ty-tool { border: 0; padding: 0; }
  .ty-strategy ~ section { display: none; }
  .ty-code, .ty-jackpot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* ---- Search ---------------------------------------------------------------------------------- */
.ty-search { max-width: var(--ty-read); }
.ty-search-form label { display: block; margin-bottom: 0.4rem; font-weight: 600; }
.ty-search-row { display: flex; gap: 0.5rem; }
.ty-search-row input { flex: 1; min-width: 0; padding: 0.7rem 0.85rem; border: 1px solid var(--ty-field); border-radius: var(--ty-radius); background: var(--ty-card); color: var(--ty-ink); font: inherit; font-size: 1.1rem; }
.ty-search-row button { padding: 0.6rem 1.1rem; border: 1px solid var(--ty-accent); border-radius: var(--ty-radius); background: var(--ty-accent); color: var(--ty-on-accent); font: inherit; font-weight: 650; cursor: pointer; }
.ty-results { margin: 0.5rem 0 0; padding: 0; list-style: none; }
.ty-results li { max-width: none; border-bottom: 1px solid var(--ty-line); }
.ty-results a { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.8rem 0.2rem; color: var(--ty-ink); text-decoration: none; }
.ty-results a:hover strong { text-decoration: underline; }
.ty-results strong { color: var(--ty-link); font-family: var(--ty-serif); font-size: 1.15rem; font-weight: 600; }
.ty-results span { color: var(--ty-muted); font-size: 0.95rem; }

/* ---- The Tools pages: the games a per-game tool covers ---------------------------------------- */
.ty-cards li:has(.ty-games) { display: flex; flex-direction: column; }
.ty-cards li:has(.ty-games) > a { height: auto; flex: 1; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ty-games { display: flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; max-width: none; margin: 0; padding: 0.55rem 1.05rem 0.7rem; border: 1px solid var(--ty-line); border-top: 0; border-radius: 0 0 var(--ty-radius) var(--ty-radius); background: var(--ty-surface); font-size: 0.88rem; }
.ty-cards .ty-games a { display: inline; height: auto; padding: 0; border: 0; background: none; color: var(--ty-link); text-decoration: underline; text-decoration-thickness: 1px; transform: none; }
.ty-cards .ty-games a:hover { text-decoration-thickness: 2px; }

/* ---- Home: the title page ---------------------------------------------------------------------- */
.ty-hero { padding: 1.5rem 0 0.5rem; }
.ty-hero h1 { max-width: 16em; margin-top: 0.8rem; font-size: clamp(2.4rem, 1.4rem + 4vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; }
.ty-hero .ty-lead { font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem); }
.ty-hero-search { max-width: 36rem; margin: 1.5rem 0 0; }
.ty-hero-search input { font-size: 1.15rem; padding: 0.8rem 1rem; }
.ty-strip { margin: 2rem 0 0.5rem; gap: 0; border-top: 1px solid var(--ty-line-strong); border-bottom: 1px solid var(--ty-line-strong); }
.ty-strip li { padding: 0.9rem 1rem 0.9rem 0; border: 0; border-radius: 0; background: none; }
.ty-strip li + li { padding-left: 1rem; border-left: 1px solid var(--ty-line); }
.ty-strip strong { display: block; color: var(--ty-ink); font-size: clamp(1.8rem, 1.4rem + 1.5vw, 2.4rem); line-height: 1.1; }
@media (max-width: 40rem) { .ty-strip li:nth-child(3) { padding-left: 0; border-left: 0; } }
.ty-checked-on { margin-top: 0.4rem; }

/* The lotteries ranked by their jackpot chance: a bar on a logarithmic scale, one tick per power of ten. */
.ty-rank { display: grid; gap: 0.1rem; margin: 1rem 0 0.4rem; padding: 0; list-style: none; }
.ty-rank li { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) minmax(8.5rem, auto); align-items: center; gap: 0.4rem 1rem; max-width: none; padding: 0.45rem 0; border-bottom: 1px solid var(--ty-line); }
.ty-rank a { font-family: var(--ty-serif); font-size: 1.1rem; font-weight: 600; text-decoration: none; }
.ty-rank a:hover { text-decoration: underline; }
.ty-rank-bar { display: block; width: 100%; height: 0.85rem; }
.ty-rank-fill { fill: var(--ty-chart); }
.ty-rank li:first-child .ty-rank-fill { fill: var(--ty-brass); }
.ty-rank-tick { stroke: var(--ty-page); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.ty-rank-chance { color: var(--ty-ink); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 36rem) {
  .ty-rank li { grid-template-columns: 1fr auto; }
  .ty-rank-bar { grid-column: 1 / -1; grid-row: 2; }
}
.ty-more { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.ty-more li { max-width: none; }
.ty-more a { font-weight: 600; }
.ty-more span { color: var(--ty-muted); font-size: 0.93rem; }

/* The tools under the three questions. */
.ty-questions { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 52rem) { .ty-questions { grid-template-columns: repeat(3, 1fr); } }
.ty-question { padding: 1rem 1.2rem 0.6rem; border: 1px solid var(--ty-line); border-top: 3px solid var(--ty-accent); border-radius: var(--ty-radius); background: var(--ty-card); }
.ty-question h3 { margin: 0.1rem 0 0.6rem; font-family: var(--ty-serif); font-size: 1.25rem; font-weight: 600; }
.ty-question ul { margin: 0; padding: 0; list-style: none; }
.ty-question li { display: flex; flex-direction: column; padding: 0.55rem 0; border-top: 1px solid var(--ty-line); }
.ty-question li a { font-weight: 650; }
.ty-question li span { color: var(--ty-muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* ---- Game pages: the headline figure, the checked badge, the page's sections ------------------- */
.ty-headline { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 2rem; margin: 1.5rem 0 0.5rem; padding: 1.1rem 0; border-top: 1px solid var(--ty-line-strong); border-bottom: 1px solid var(--ty-line-strong); }
.ty-hero-figure { margin: 0; max-width: none; }
.ty-hero-figure strong { display: block; color: var(--ty-brass); font-family: var(--ty-serif); font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.4rem); font-weight: 600; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.01em; }
.ty-badge { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.8rem 0.4rem 0.45rem; border: 1px solid var(--ty-line-strong); border-radius: 999px; background: var(--ty-card); color: var(--ty-ink); font-size: 0.92rem; text-decoration: none; }
.ty-badge:hover { border-color: var(--ty-accent); }
.ty-badge-mark { width: 1.5rem; height: 1.5rem; flex: none; }
.ty-toc { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; margin: 0.6rem 0 0; font-size: 0.93rem; }
.ty-toc a { color: var(--ty-muted); }
.ty-toc a:hover { color: var(--ty-ink); }
.ty-chance-bar { display: block; width: 100%; max-width: 9rem; height: 4px; margin-top: 0.3rem; }
.ty-chance-bar rect { fill: var(--ty-chart); opacity: 0.75; }
.ty-jackpot .ty-chance-bar rect { fill: var(--ty-brass); opacity: 1; }
.ty-faq { border-bottom: 1px solid var(--ty-line); max-width: var(--ty-read); }
.ty-faq summary { padding: 0.8rem 0; font-weight: 650; list-style-position: outside; }
.ty-faq summary::marker { color: var(--ty-brass); }
.ty-faq p { margin: 0 0 0.9rem; }
.ty-embed-box { margin: 2.5rem 0 0; padding: 0.8rem 1rem; border: 1px solid var(--ty-line); border-radius: var(--ty-radius); background: var(--ty-card); max-width: var(--ty-read); }
.ty-embed-box summary { font-weight: 650; }
.ty-embed-box[open] summary { margin-bottom: 0.5rem; }
html { scroll-padding-top: 1rem; }
:target { scroll-margin-top: 1rem; }

/* ---- The simulator chart: where the players ended ------------------------------------------------- */
.ty-hist { max-width: 40rem; }
.ty-hist figcaption { margin-bottom: 0.5rem; font-weight: 600; }
.ty-hist svg { padding: 0.75rem 0.75rem 0; }
.ty-hist rect { fill: var(--ty-chart); }
.ty-hist-axis { display: flex; justify-content: space-between; max-width: none; margin: 0.3rem 0 0; color: var(--ty-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* ---- Tools on a wide screen: the form on the left, the result beside it and kept in view -------- */
@media (min-width: 64rem) {
  .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) { display: grid; grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr); column-gap: 2rem; align-items: start; }
  .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) > * { grid-column: 1 / -1; }
  .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) > form { grid-column: 1; grid-template-columns: 1fr; }
  .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) > .ty-result { grid-column: 2; position: sticky; top: 1rem; margin-top: 0; padding: 0 0 0 2rem; border-top: 0; border-left: 1px solid var(--ty-line); }
  .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) .ty-field input, .ty-tool:has(> form):has(> .ty-result):not(:has(.ty-felt)) .ty-form select { max-width: none; }
}
.ty-tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 1rem 0 0.6rem; padding-top: 0.8rem; border-top: 1px solid var(--ty-line); }
.ty-tool-actions button { padding: 0.35rem 0.8rem; border: 1px solid var(--ty-line-strong); border-radius: 999px; background: transparent; color: var(--ty-ink); font: inherit; font-size: 0.9rem; cursor: pointer; }
.ty-tool-actions button:hover { border-color: var(--ty-accent); color: var(--ty-link); }
@media print { .ty-tool-actions { display: none !important; } }

/* ---- "Is it worth it?": what a play pays back, against its price ------------------------------- */
.ty-payback { max-width: 34rem; margin: 0.6rem 0 1rem; }
.ty-payback svg { display: block; width: 100%; height: 1.1rem; border-radius: 2px; overflow: hidden; }
.ty-payback-track { fill: var(--ty-surface); stroke: var(--ty-line-strong); stroke-width: 0.3; vector-effect: non-scaling-stroke; }
.ty-payback-other { fill: var(--ty-chart); }
.ty-payback-jackpot { fill: var(--ty-brass); }
.ty-payback-key { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin-top: 0.4rem; color: var(--ty-muted); font-size: 0.88rem; }
.ty-payback-key span::before { content: ""; display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.35rem; border-radius: 2px; vertical-align: -0.05rem; }
.ty-key-other::before { background: var(--ty-chart); }
.ty-key-jackpot::before { background: var(--ty-brass); }
.ty-key-lost::before { background: var(--ty-surface); outline: 1px solid var(--ty-line-strong); outline-offset: -1px; }

/* ---- The next draw's estimated jackpot, read from the operator ----------------------------------- */
.ty-next-jackpot { max-width: var(--ty-read); margin: 0.75rem 0 0; padding: 0.6rem 0.9rem; border-left: 3px solid var(--ty-brass); background: var(--ty-card); border-radius: 0 var(--ty-radius) var(--ty-radius) 0; font-size: 0.95rem; }
.ty-next-jackpot strong { color: var(--ty-brass-ink); font-variant-numeric: tabular-nums; }
