/* My bets, and its ticket (the docket), which js/ticket.js draws for My bets, the slip and Today. Linked right after
   styles.css, where these rules were until they had a sheet of their own, so they cascade as they did. Colours are the
   tokens in styles.css. */

/* My bets: offers first, then what waits on the bookie, then open and settled bets. Each bet is a docket: its legs on
   the card, and below them a stub a step darker that carries the money, cut off by two 14px notches. The notches are
   masks, so the ground shows through them wherever the docket sits. One status mark per ticket (the pill on a settled
   bet); no side edge. */
.bets { display: grid; gap: 4px; padding-bottom: 16px; }
.bets .sum { margin-bottom: 8px; }
.bets-section { min-width: 0; }
.tickets { display: grid; gap: 10px; }
.ticket { position: relative; display: grid; min-width: 0; border-radius: var(--radius); }
.ticket-body, .ticket-stub { position: relative; display: grid; gap: 10px; min-width: 0; }
.ticket-body {
  padding: 14px 16px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--ticket, var(--surface));
  -webkit-mask: radial-gradient(circle at 0 100%, #0000 7px, #000 7.5px) 0 0 / 51% 100% no-repeat, radial-gradient(circle at 100% 100%, #0000 7px, #000 7.5px) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 100%, #0000 7px, #000 7.5px) 0 0 / 51% 100% no-repeat, radial-gradient(circle at 100% 100%, #0000 7px, #000 7.5px) 100% 0 / 51% 100% no-repeat;
}
.ticket-stub {
  padding: 12px 16px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--stub, var(--surface-2));
  -webkit-mask: radial-gradient(circle at 0 0, #0000 7px, #000 7.5px) 0 0 / 51% 100% no-repeat, radial-gradient(circle at 100% 0, #0000 7px, #000 7.5px) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 0, #0000 7px, #000 7.5px) 0 0 / 51% 100% no-repeat, radial-gradient(circle at 100% 0, #0000 7px, #000 7.5px) 100% 0 / 51% 100% no-repeat;
}
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.ticket-type { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: calc(14px * var(--type)); font-weight: 700; }
.ticket-legs { display: grid; gap: 8px; }
.ticket-leg { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 22px; gap: 10px; align-items: center; }
.ticket-leg .leg-mark { display: grid; place-items: center; width: 28px; }
.ticket-leg .leg-mark .cloth { width: 26px; height: 26px; border-radius: 8px; font-size: calc(12px * var(--type)); }
.ticket-leg .glyph .ico { width: 18px; height: 18px; }
.leg-pick { display: grid; min-width: 0; }
.leg-name { font-size: calc(15px * var(--type)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A leg's line wraps on a phone, its time kept whole (.leg-when): the time is the part a player looks for, and was cut
   to "Today 0..." (20.11.2026). */
.leg-match { font-size: calc(12px * var(--type)); color: var(--muted); overflow-wrap: anywhere; }
.leg-when { white-space: nowrap; }
/* The player's own side in a fixture, in the slip and on a ticket: "Turkey v Belgium" with Belgium in weight. */
.leg-match b { font-weight: 600; color: var(--text); }
/* A ticket leg's score in place of the "v" ("Turkey 1-0 Belgium"): live as last read (the time in its tooltip), or the
   final score, in ink like the side picked. */
.leg-score { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.leg-odds { font-size: calc(15px * var(--type)); font-weight: 700; text-align: right; white-space: nowrap; }
.leg-state { display: grid; place-items: center; width: 22px; color: var(--faint); }
.leg-state .ico { width: 16px; height: 16px; stroke-width: 2.25; }
/* A leg that won is ticked in ink: the money it paid, if above the amount, is the stub's green (Nic, 15.11.2026). */
.leg-state.is-won { color: var(--text); }
.leg-state.is-placed { color: var(--placed); }
.leg-state.is-lost { color: var(--loss); }
.ticket-leg.is-lost .leg-name { color: var(--muted); }

/* A bet builder's legs (17.11.2026, js/ticket.js builderPartsHtml), under its match in the slip, on a ticket and on the
   bookie's referral card: one a line with its side's mark and, once decided, its state's mark as a leg's (a tick in
   ink, a cross in the loss colour, a dash for one void); a leg removed (its player did not play) is struck through. */
.bb-parts { display: grid; gap: 4px; margin-top: 6px; }
/* On a ticket, its legs and its notes take a row of their own under its name, the mark, price and state beside it. */
.ticket-leg > .bb-parts, .ticket-leg > .bb-note { grid-column: 2 / -1; }
.ticket-leg > .bb-parts { margin-top: -6px; }
.ticket-leg > .bb-note { margin-top: -6px; white-space: normal; }
.bb-part { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; font-size: calc(13px * var(--type)); font-weight: 500; color: var(--text); }
.bb-part-mark { display: grid; place-items: center; }
.bb-part-mark > .flag, .bb-part-mark > .initials { width: 18px; height: 13px; }
.bb-part-mark > .draw-mark { width: 18px; height: 14px; }
.bb-part-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-part-state { display: grid; place-items: center; width: 18px; color: var(--faint); }
.bb-part-state .ico { width: 13px; height: 13px; stroke-width: 2.5; }
.bb-part-state.is-won { color: var(--text); }
.bb-part-state.is-lost { color: var(--loss); }
.bb-part.is-lost .bb-part-name { color: var(--muted); }
.bb-part.is-void .bb-part-name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }

/* The leg stack: the logo's slanted bars, one per leg of a multiple. Gold in the slip; on a ticket each bar is its leg:
   won, placed, void and lost filled, live a ring in the live colour, to come a faint ring. On a long multiple the bars
   narrow, so the stack never runs past about 84px. */
.stack { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.stack > i { display: block; width: 14px; height: 6px; border-radius: 1px; transform: skewX(calc(var(--lean) * -1)); background: var(--highlight); }
.stack:has(> i:nth-child(6)) > i { width: 9px; }
.stack:has(> i:nth-child(8)) { gap: 2px; }
.stack:has(> i:nth-child(8)) > i { width: 6px; }
.stack > i.is-won { background: var(--text); }
.stack > i.is-placed { background: var(--placed); }
.stack > i.is-void { background: var(--void); }
.stack > i.is-lost { background: var(--loss); }
.stack > i.is-live { background: transparent; box-shadow: inset 0 0 0 1.5px var(--live); }
.stack > i.is-open { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
/* A leg decided while the ticket is open fills its bar from the left. */
.stack > i.is-fresh { transform-origin: 0 50%; animation: bar-fill .2s ease-out both; }
@keyframes bar-fill { from { transform: skewX(calc(var(--lean) * -1)) scaleX(0); } to { transform: skewX(calc(var(--lean) * -1)) scaleX(1); } }

/* The stub: stake, the bet reference and what it returns. The return is in the win colour only when the bet paid back
   more than its stake; at or below the stake it is in ink with what it came to under it, and a loss's £0.00 is faint. */
.stub-figures { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 14px; }
.stub-figures dt { font-size: calc(12px * var(--type)); font-weight: 500; color: var(--stub-label, var(--faint)); }
.stub-figures dd { margin-top: 1px; font-size: calc(16px * var(--type)); font-weight: 700; }
.stub-figures .ticket-when { font-size: calc(13px * var(--type)); font-weight: 500; color: var(--muted); }
.stub-return { text-align: right; }
.ticket-ref { display: block; font-size: calc(13px * var(--type)); font-weight: 600; color: var(--muted); }
/* Ref: the bet reference behind a tap (a phone) or the pointer (its tooltip), dotted to say there is more. */
.ref-btn { padding: 2px 0; font: inherit; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.ref-btn[aria-expanded="true"] { color: var(--text); }
/* When the bet went on, under Ref: a clock, then the time ago (Nic, 19.11.2026). */
.stub-ref .ticket-when { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-size: calc(12px * var(--type)); }
.stub-ref .ticket-when .ico { width: 13px; height: 13px; stroke-width: 2; }
.stub-figure { transform-origin: 100% 50%; }
.stub-figure.is-up { color: var(--win); }
.stub-figure.is-none { color: var(--stub-label, var(--faint)); }
.stub-net { display: block; margin-top: 1px; font-size: calc(12px * var(--type)); font-weight: 600; color: var(--muted); }
.ticket-total { display: block; font-size: calc(12px * var(--type)); font-weight: 500; color: var(--stub-label, var(--faint)); }
.ticket-part { display: block; }
.ticket-part + .ticket-part { font-size: calc(13px * var(--type)); font-weight: 600; color: var(--muted); }
.leg-link { border-radius: 8px; }
.leg-link:hover .leg-name { text-decoration: underline; text-underline-offset: 3px; }
.request-status { color: var(--muted); }
.ticket.request .ticket-head .icon-btn { margin: -6px -8px -6px 0; }
/* A counter-offer on a ticket sent whole or a request a bet names what it is under its head (16.11.2026). */
.ticket-kind { margin: -4px 0 0; font-size: calc(13px * var(--type)); font-weight: 600; color: var(--muted); }
/* The end of a ticket's head on My bets: its status pill, then "Ask about this bet", a quiet chat icon sitting in the
   head's line as a referral's control does. */
.ticket-end { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.ticket-head .ticket-ask { margin: -6px -8px -6px 0; }
.ticket-head .ticket-follow { margin: -6px 0; }
.ticket-follow.is-on { color: var(--highlight); }
.offer-terms s { display: block; font-size: calc(12px * var(--type)); font-weight: 500; color: var(--stub-label, var(--faint)); }
/* When the offer expires ("Expires 16:23"), in plain ink: a time, not a countdown. Under the terms, a calm bar drains to
   it in the muted ink, never red; nothing on the card changes faster than its drain (Nic, 15.11.2026). */
.offer-time { font-size: calc(14px * var(--type)); font-weight: 600; color: var(--muted); text-align: right; }
.offer.is-expired .offer-time { color: var(--faint); }
.offer.is-expired .offer-terms dd, .offer.is-expired .leg-name { color: var(--muted); }
.offer.is-compact .ticket-body { gap: 8px; padding: 12px 14px 10px; }
.offer.is-compact .ticket-stub { gap: 8px; padding: 10px 14px 12px; }
.offer.is-compact .offer-answer .icon-btn { height: 44px; }
.offer-clock { height: 4px; border-radius: 4px; background: var(--clock, var(--surface-3)); overflow: hidden; }
.offer-bar { display: block; height: 100%; border-radius: 4px; background: var(--muted); transform-origin: 0 50%; }
.offer-answer { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.offer-answer .icon-btn.primary { width: 100%; }
.offer-answer .icon-btn { width: 64px; height: 52px; }
/* Decline: the cross alone inside the strong line, on no fill, as the phone draws it (Ryan, 21.11.2026). The second
   surface it wore is the stub's own colour, so it showed no target. */
.offer-answer .icon-btn:not(.primary) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.offer-answer .icon-btn:not(.primary):hover:not(:disabled) { background: var(--surface-3); }

/* A lost bet recedes: its card and stub sink toward the ground and its marks dim to 72%, while its words keep their
   contrast. */
.ticket.is-lost { --ticket: color-mix(in srgb, var(--surface) 72%, var(--ground)); --stub: color-mix(in srgb, var(--surface-2) 72%, var(--ground)); }
.ticket.is-lost :is(.leg-mark, .stack, .leg-state) { opacity: .72; }

/* A bet that just went on drops in, ringed in gold for 2.6 seconds (held still for 2 with reduced motion). The ring
   follows the docket round its notches. */
.ticket-body::after, .ticket-stub::after { content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: 0; pointer-events: none; }
.ticket-body::after { box-shadow: inset 2px 0 var(--highlight), inset -2px 0 var(--highlight), inset 0 2px var(--highlight); }
.ticket-stub::after { box-shadow: inset 2px 0 var(--highlight), inset -2px 0 var(--highlight), inset 0 -2px var(--highlight); }
.ticket.is-new :is(.ticket-body, .ticket-stub)::after { animation: lit-ring 2.6s ease-out; }
.ticket.is-new { animation: ticket-in .5s var(--ease); }
@keyframes lit-ring { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ticket-in { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }
/* A bet that settles with My bets open: the stub's figure inks in (160ms), no stamp; a lost one sinks back (300ms). */
.ticket.is-settling .stub-figure { animation: ink .16s ease-out both; }
@keyframes ink { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.ticket.is-lost.is-settling .ticket-body { animation: sink-body .3s ease-out both; }
.ticket.is-lost.is-settling .ticket-stub { animation: sink-stub .3s ease-out both; }
.ticket.is-lost.is-settling :is(.leg-mark, .stack, .leg-state) { animation: dim .3s ease-out both; }
@keyframes sink-body { from { background-color: var(--surface); } }
@keyframes sink-stub { from { background-color: var(--surface-2); } }
@keyframes dim { from { opacity: 1; } }
.offer.is-leaving { animation: leg-out .2s ease-in forwards; }
.empty .icon-btn.primary { margin-top: 4px; }
/* A ticket cashed out reads as Won does: green only when it paid more than its amount (statusLit). */
.pill.is-cashed_out { color: var(--win); background: color-mix(in srgb, var(--win) 14%, var(--surface)); }
/* A live Lucky ticket on races: its bonus rule behind the pill, a tap on a phone, a tooltip on a computer. */
.pill-btn { cursor: pointer; }
.pill-btn[aria-expanded="true"] { color: var(--text); }
.ticket-tip { font-size: calc(13px * var(--type)); color: var(--muted); }

/* The stub's rows under its figures: what partial cash outs paid, a Lucky bonus. A label at the left, the figure at the
   right with its quiet line under it. */
.stub-rows { display: grid; gap: 6px; }
.stub-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.stub-row dt { font-size: calc(12px * var(--type)); font-weight: 500; color: var(--stub-label, var(--faint)); }
.stub-row dd { text-align: right; font-size: calc(15px * var(--type)); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Cash out (17.11.2026): a band across the foot of a live ticket's stub, a rule above it: its label, the value (green
   only above the amount it is for, ink otherwise), partial cash out and the cash out itself, an ink button with the
   coins that arms on the first tap. A value that moved fades in, no roll and no flash; suspended, a pause mark and the
   word in the faint ink. */
.cash-out { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.cash-out.is-suspended { grid-template-columns: 20px minmax(0, 1fr) auto; min-height: 44px; }
.cash-mark { display: grid; place-items: center; color: var(--muted); }
.cash-mark .ico { width: 18px; height: 18px; }
.cash-label { font-size: calc(13px * var(--type)); font-weight: 600; color: var(--muted); }
.cash-value { font-size: calc(17px * var(--type)); font-weight: 700; font-variant-numeric: tabular-nums; }
.cash-value.is-up { color: var(--win); }
.cash-value.is-moved { animation: cash-in .24s var(--ease); }
@keyframes cash-in { from { opacity: .35; } to { opacity: 1; } }
.cash-out.is-suspended .cash-value { font-size: calc(13px * var(--type)); font-weight: 600; color: var(--faint); }
.cash-btn { background: var(--text); color: var(--surface); }
/* Partial cash out's toggle stays pressed while its slider is open. */
.cash-out [data-action="cash-part"][aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.cash-btn:hover:not(:disabled) { background: var(--text); opacity: .88; }
.cash-btn .ico { width: 20px; height: 20px; }
/* Partial cash out: the slider, then what it pays and the amount left running, then its own cash out. */
.cash-part { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; }
.cash-range { grid-column: 1 / -1; width: 100%; height: 44px; margin: 0; accent-color: var(--text); cursor: pointer; }
.cash-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cash-split dt { font-size: calc(12px * var(--type)); font-weight: 500; color: var(--stub-label, var(--faint)); }
.cash-split dd { margin-top: 1px; font-size: calc(15px * var(--type)); font-weight: 700; font-variant-numeric: tabular-nums; }

@media (min-width: 1024px) {
  .tickets { grid-template-columns: repeat(auto-fill, minmax(calc(340px * var(--type)), 1fr)); align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
  .ticket.is-new :is(.ticket-body, .ticket-stub)::after { animation: none !important; opacity: 1; }
}
