/* horseracingcalculator.com: a white bet slip on the pale green of the rail, racing-green ink. */
@font-face {
  font-family: "Red Hat Text";
  src: url("/redhat-text.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --rail: #edf2ec;
  --paper: #ffffff;
  --ink: #10352a;
  --ink-soft: #4b6158;
  --rule: #c6d3ca;
  --silk: #b0124d;
  --turf: #1d5a44;
  --wash: #f6f9f5;
  --warn: #8a2a0b;
  --r: 6px;
  --spalte: 44rem;
  --bred: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }
/* Two content widths, no more (smaller-sites/README.md): --spalte the text column (the h1, the standfirst, the text,
   the small price boards, every calculator card with its fields), --bred the full page (the bar, the bet slip, the
   wide boards, the footer). */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--rail);
  color: var(--ink);
  font: 400 1.0625rem/1.6 "Red Hat Text", system-ui, sans-serif;
  font-variant-numeric: lining-nums;
}
a { color: var(--turf); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--silk); }
:focus-visible { outline: 3px solid var(--silk); outline-offset: 2px; }
.jumpto { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .5rem 1rem; z-index: 9; }
.jumpto:focus { left: 1rem; }
.railwidth { max-width: var(--bred); margin: 0 auto; padding: 0 1rem; }

/* Masthead: the name on a racing-green band. */
.masthead { background: var(--ink); color: #fff; }
.masthead .railwidth { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.5rem; padding-top: .6rem; padding-bottom: .6rem; }
.nameplate { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-size: 1.1rem; font-weight: 500; white-space: nowrap; }
.nameplate b { font-weight: 700; }
.nameplate svg { width: 1.6rem; height: 1.6rem; color: var(--ink); }
.nameplate:hover { color: #fff; }
.topnav { display: flex; gap: .2rem 1rem; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.topnav a { color: #d9e6dd; text-decoration: none; font-size: .95rem; white-space: nowrap; padding: .35rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }

/* Title block */
.titleblock .railwidth { padding-top: 1.1rem; padding-bottom: .4rem; }
.crumbline { font-size: .875rem; color: var(--ink-soft); margin-bottom: .25rem; }
.crumbline a { color: var(--ink-soft); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); line-height: 1.12; letter-spacing: -.012em; margin: 0 0 .35rem; font-weight: 700; max-width: var(--spalte); }
.standfirst { margin: 0 0 1rem; color: var(--ink-soft); font-size: 1.05rem; max-width: var(--spalte); }

article { padding-bottom: 2.5rem; }
article > :is(p, ul, ol, h2, h3, .board, details, aside, blockquote, dl, .readings) { max-width: var(--spalte); }
article h2 { font-size: 1.5rem; line-height: 1.25; margin: 2.2rem 0 .6rem; letter-spacing: -.005em; }
article h3 { font-size: 1.15rem; line-height: 1.3; margin: 1.6rem 0 .4rem; }
.opening { font-size: 1.1rem; margin-top: 1.6rem; }
dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: .8rem 0 1.2rem; padding: .8rem 1rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); }
dl.terms dt { font-weight: 700; }
dl.terms dd { margin: 0; }
.sum-rule { display: inline-block; background: var(--paper); border-left: 3px solid var(--turf); padding: .5rem 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
details.more-prices { margin: .6rem 0 1.5rem; }
details.more-prices summary { cursor: pointer; color: var(--turf); font-weight: 600; padding: .3rem 0; }
details.more-prices .board { margin-top: .6rem; }
@media (max-width: 30rem) {
  dl.terms { grid-template-columns: 1fr; gap: .1rem; }
  dl.terms dd { margin-bottom: .5rem; }
}
.checked { color: var(--ink-soft); font-size: .9rem; margin-top: 2rem; }
.readings { border-top: 1px solid var(--rule); margin-top: 1.5rem; font-size: .925rem; }
.readings h2 { font-size: 1.1rem; }
.racecard { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: .6rem 1rem; margin: 1rem 0; }
.racecard summary { cursor: pointer; font-weight: 600; }

/* Tables printed from the engine */
.board { overflow-x: auto; margin: 1rem 0 1.5rem; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); }
.board table { border-collapse: collapse; width: 100%; font-size: .975rem; }
.board caption { text-align: left; font-weight: 600; padding: .7rem .9rem .3rem; }
.board th, .board td { padding: .45rem .9rem; text-align: left; border-top: 1px solid var(--rule); white-space: nowrap; }
.board thead th { font-weight: 600; color: var(--ink-soft); font-size: .9rem; }
.fig { text-align: right !important; font-variant-numeric: tabular-nums; }
.board.cards td:not(.fig) { white-space: normal; min-width: 6rem; }
article > .board.cards { max-width: none; }
.board.cards td { vertical-align: top; }

/* The bet slip */
.slip {
  display: grid; gap: 0 1.25rem; grid-template-columns: minmax(0, 1fr);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1rem; margin: 0 0 2rem;
}
.slip-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; padding-bottom: .9rem; border-bottom: 1px solid var(--rule); }
.fld, .pick { display: flex; flex-direction: column; gap: .2rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.cap { font-size: .85rem; font-weight: 600; color: var(--ink-soft); padding: 0; }
.slip input:not([type]), .slip input[inputmode], .slip select, .convert input {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--wash);
  border: 1px solid var(--rule); border-radius: var(--r); padding: .5rem .6rem; width: 100%; min-height: 2.75rem;
}
.slip select { padding-right: 1.6rem; }
.slip input:focus, .slip select:focus, .convert input:focus { border-color: var(--turf); background: #fff; }
[aria-invalid="true"] { border-color: var(--warn) !important; }
.err { color: var(--warn); font-size: .85rem; min-height: 0; }
.err:empty { display: none; }
.cash { position: relative; display: block; }
.pick { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; align-self: end; min-height: 2.75rem; }
.pick legend { width: 100%; float: left; margin-bottom: .1rem; }
.pick label, .tick { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.slip input[type="radio"], .slip input[type="checkbox"] { accent-color: var(--turf); width: 1.15rem; height: 1.15rem; margin: 0; }

.legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.leg { padding: .8rem 0; border-bottom: 1px dashed var(--rule); }
.leg-no { margin: 0 0 .35rem; font-weight: 700; font-size: .95rem; }
.leg-main, .by-runners, .own-terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; }
.by-runners { align-items: end; }
.by-runners .tick { min-height: 2.75rem; }
.ew-terms { display: grid; gap: .6rem; margin-top: .6rem; }
.more { margin-top: .6rem; }
.more summary { cursor: pointer; color: var(--turf); font-size: .95rem; font-weight: 500; }
.more-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; margin-top: .6rem; }
.more-in .nonew { grid-column: 1 / -1; }
.more-in label:has([data-f="wd"]) { grid-column: 1 / -1; }
[hidden] { display: none !important; }
.acca { margin: .8rem 0 0; display: flex; gap: .6rem; flex-wrap: wrap; }
.acca button {
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--turf); background: var(--paper);
  border: 1px solid var(--turf); border-radius: var(--r); padding: .45rem .9rem; cursor: pointer;
}
.acca button:disabled { opacity: .45; cursor: default; }
/* A button that sets the page's calculator to a bet (node 7: its table and each bet's section). */
.settle {
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--turf); background: var(--paper);
  border: 1px solid var(--turf); border-radius: var(--r); padding: .3rem .7rem; cursor: pointer; white-space: nowrap;
}
.settle:hover { background: var(--turf); color: #fff; }
.settle-line { margin: .2rem 0 .9rem; }

/* The stub: the tear-off part of the slip, with its perforation. */
.stub {
  display: block; position: sticky; bottom: 0; z-index: 2; margin: 1rem -1rem -1rem; padding: 1rem 1rem .8rem;
  background: var(--ink); color: #fff; border-radius: 0 0 var(--r) var(--r);
  background-image: radial-gradient(circle at 6px -1px, var(--paper) 4px, transparent 4.5px);
  background-size: 12px 8px; background-repeat: repeat-x; background-position: 0 0;
}
.stub .todo { margin: .3rem 0 0; color: #d9e6dd; }
.sums { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: .5rem; margin: .3rem 0 0; }
.sums div { min-width: 0; }
.sums dt { font-size: .8rem; color: #b9cfc2; }
.sums dd { margin: 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sums .ret dd { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.count, .halves { margin: .2rem 0 0; font-size: .85rem; color: #b9cfc2; }
.lines-out { grid-column: 1 / -1; }
.lines-out:empty { display: none; }
.working { margin-top: 1.6rem; }
.working summary { cursor: pointer; font-weight: 600; color: var(--turf); }
.working ul { padding-left: 1.1rem; font-size: .95rem; }
.lines { overflow-x: auto; max-height: 26rem; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--r); margin-top: .5rem; }
.lines table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.lines th, .lines td { padding: .35rem .7rem; border-top: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.lines thead th { position: sticky; top: 0; background: var(--wash); border-top: 0; }

/* The odds converter */
.convert { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem; margin: 0 0 2rem; max-width: var(--spalte); }
.converted { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; margin: 1rem 0 0; }
.converted div { border-top: 2px solid var(--ink); padding-top: .3rem; }
.converted dt { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.converted dd { margin: 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.6em; }

/* Beside every calculator: free, nothing stored; under every result: the help lines. */
.free { margin: 0 0 .8rem; font-size: .9rem; font-weight: 600; color: var(--turf); }
.helpnote { margin: .8rem 0 0; font-size: .85rem; line-height: 1.45; color: var(--ink-soft); }
.stub .helpnote { color: #c9dbd0; border-top: 1px solid rgba(255,255,255,.18); padding-top: .55rem; }
.stub .helpnote a { color: #fff; }
.stub .helpnote a:hover { color: #ffd5e3; }
.count, .halves { margin: .45rem 0 0; font-size: .9rem; color: #c9dbd0; }

/* An each-way single: wins, places, loses, side by side. */
.ifs { grid-column: 1 / -1; margin-top: 1.4rem; overflow-x: auto; }
.ifs table { border-collapse: collapse; width: 100%; font-size: .975rem; }
.ifs caption { text-align: left; font-weight: 600; padding: 0 0 .4rem; }
.ifs th, .ifs td { padding: .45rem .7rem; border-top: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.ifs thead th { font-size: .9rem; color: var(--ink-soft); border-top: 0; text-align: right; }
.ifs tr.sum > * { font-weight: 700; border-top: 2px solid var(--ink); }
.lines tr.lost td { color: #8a9a92; }
.ifs table + table { margin-top: 1.1rem; }
.ifs tr.lost > * { color: #8a9a92; }
/* A formula written out in words, set apart from the text around it. */
.workings { border-left: 3px solid var(--turf); padding: .3rem 0 .3rem .9rem; font-weight: 600; }

/* A pool bet: the payout from the declared dividend. */
.pool { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem; margin: 1rem 0 1.5rem; max-width: var(--spalte); }
.pool-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; }
.pool input, .pool select {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--wash);
  border: 1px solid var(--rule); border-radius: var(--r); padding: .5rem .6rem; width: 100%; min-height: 2.75rem;
}
.pool input:focus, .pool select:focus { border-color: var(--turf); background: #fff; }
.pool-out { margin-top: .9rem; border-top: 2px solid var(--ink); padding-top: .5rem; }
.pool-out .todo { margin: .2rem 0 0; color: var(--ink-soft); font-size: .95rem; }
.pool-out .paid { margin: 0; display: flex; align-items: baseline; gap: .7rem; }
.pool-out .paid span { font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.pool-out .paid b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }

/* The pools and the order bets (release 3): the same white card as the pool bet, its inputs and its result. */
.poolsum, .wps, .ordercost, .legcost { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem; margin: 1rem 0 1.5rem; max-width: var(--spalte); }
.poolsum-in, .ordercost-in, .legcost-head, .ordercost-payin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem .8rem; }
.poolsum input, .poolsum select, .wps input, .ordercost input:not([type="radio"]), .ordercost select, .legcost input, .legcost select {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--wash);
  border: 1px solid var(--rule); border-radius: var(--r); padding: .5rem .6rem; width: 100%; min-height: 2.75rem;
}
.poolsum :is(input, select):focus, .wps input:focus, .ordercost :is(input, select):focus, .legcost :is(input, select):focus { border-color: var(--turf); background: #fff; }
.ordercost input[type="radio"] { accent-color: var(--turf); width: 1.15rem; height: 1.15rem; margin: 0; }
.ordercost .pick, .ordercost .box-row, .ordercost .pos-row { grid-column: 1 / -1; }
.unit-fld { grid-column: 1 / -1; }
.unit-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.unit-chips button, .ordercost .unit-chips button {
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--turf); background: #fff;
  border: 1px solid var(--turf); border-radius: 999px; padding: .3rem .9rem; min-height: 2.25rem; cursor: pointer;
}
.unit-chips button:hover { background: var(--wash); }
.poolsum-out, .wps-out, .ordercost-out, .legcost-out { margin-top: .9rem; border-top: 2px solid var(--ink); padding-top: .5rem; }
.ordercost-pay { margin-top: 1rem; padding-top: .7rem; border-top: 1px dashed var(--rule); }
.ordercost-pay > .cap { margin: 0 0 .4rem; }
.ordercost-ret { margin-top: .5rem; }
:is(.poolsum-out, .wps-out, .ordercost-out, .legcost-out, .ordercost-ret) .todo { margin: .2rem 0 0; color: var(--ink-soft); font-size: .95rem; }
:is(.wps-out, .ordercost-out, .legcost-out, .ordercost-ret) .paid { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; }
:is(.wps-out, .ordercost-out, .legcost-out, .ordercost-ret) .paid span { font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
:is(.wps-out, .ordercost-out, .legcost-out, .ordercost-ret) .paid b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
/* The pool's steps: a ledger, each amount under the one before. */
.poolsum-steps { margin: 0 0 .4rem; max-width: 28rem; }
.poolsum-steps div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px dotted var(--rule); }
.poolsum-steps dt { color: var(--ink-soft); }
.poolsum-steps dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.poolsum-out .board { margin: .7rem 0 .5rem; }
/* Win, place and show: one row per bet. */
.wps-rows { display: grid; gap: .2rem; }
.wps-row { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) minmax(0, 1fr); gap: .3rem .8rem; align-items: end; padding: .5rem 0; border-bottom: 1px dashed var(--rule); }
.wps-name { margin: 0; font-weight: 700; align-self: center; padding-top: 1.1rem; }
.wps-ret { grid-column: 2 / -1; margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.wps-ret:empty { display: none; }
/* The races of a multi-race bet, side by side. */
.legcost-cap { margin: .9rem 0 .3rem; }
.legcost-legs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem .8rem; }
@media (min-width: 46rem) {
  .poolsum-in { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .legcost-legs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .ordercost-payin { grid-template-columns: repeat(2, minmax(0, 16rem)); }
}

/* On a phone a table of sentences becomes one card per row, each cell with its heading. */
@media (max-width: 45.99rem) {
  .board.cards { background: none; border: 0; overflow: visible; }
  .board.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .board.cards caption { padding: 0 0 .5rem; }
  .board.cards tr { display: block; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); margin: 0 0 .6rem; padding: .3rem 0; }
  .board.cards td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .6rem; border: 0; padding: .2rem .8rem; white-space: normal; }
  .board.cards td::before { content: attr(data-label); font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
  .board.cards td:first-child { font-weight: 700; font-size: 1.05rem; }
  .board.cards td.fig { text-align: left !important; }
  .board.compact tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board.compact td { grid-template-columns: 1fr; gap: 0; padding: .3rem .8rem; }
  .board.compact td:first-child { grid-row: 1; grid-column: 1; align-self: center; }
  .board.compact td:last-child { grid-row: 1; grid-column: 2; justify-self: end; align-self: center; }
  .board.compact td:first-child::before, .board.compact td:last-child::before { content: none; }
  /* A compact card whose headline figure needs its name, such as the return per $2. */
  .board.compact.labelled td:last-child { text-align: right !important; }
  .board.compact.labelled td:last-child::before { content: attr(data-label); }
}

/* Footer: the help lines first. */
.baseboard { background: var(--paper); border-top: 1px solid var(--rule); font-size: .95rem; }
.baseboard .railwidth { padding-top: 1.5rem; padding-bottom: 2rem; }
.helplines h2 { font-size: 1.1rem; margin: 0 0 .4rem; }
.helplines ul { margin: 0 0 .4rem; padding-left: 1.1rem; }
.helplines li { margin: .2rem 0; }
.about-line { color: var(--ink-soft); max-width: var(--spalte); margin: 1.2rem 0; }
.foot-nav { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }

@media (min-width: 46rem) {
  .slip-head { grid-template-columns: 1.4fr 1fr 1.3fr .7fr; }
  .leg-main { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 64rem) {
  .slip { grid-template-columns: minmax(0, 1fr) 19rem; padding: 1.2rem; }
  .free, .slip-head, .slip > .err, .acca { grid-column: 1; }
  .pool-in { grid-template-columns: 1.2fr 1.2fr 1fr .7fr; }
  .legs { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.25rem; }
  .stub { grid-column: 2; grid-row: 1 / span 5; align-self: start; position: sticky; top: 1rem; bottom: auto; margin: 0; border-radius: var(--r); padding: 1.3rem 1.1rem 1rem; }
  .sums { grid-template-columns: 1fr; gap: .7rem; }
  .sums .ret dd { font-size: 2.1rem; }
  .converted { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media (forced-colors: active) { .stub { border: 2px solid CanvasText; } }
