/* VS — QA2 usability layer (loaded last, after theme.css).
   Header fit at tablet widths, 44px touch targets, glossary tooltips, the live
   scores-only view, match reminders, the account-menu session panel and the
   shared bet slip page. Tokens only: no new colours. */

/* ---------- header: 768–1099px used to overflow (user chip at 797px on a 768px screen) ---------- */
@media (min-width: 768px) and (max-width: 1099px) {
  .header-inner { gap: 4px; }
  .hdr-divider { margin: 0 6px; }
  .header-nav .nav-wallet, .header-nav .nav-news, .header-actions .hdr-support { display: none; }
  .header-nav { min-width: 0; overflow: hidden; }
}
@media (min-width: 768px) and (max-width: 899px) {
  .brand .logo-mark, .brand svg, .brand img { max-height: 30px; width: auto; }
}
/* UI audit: 1100–1279px the five nav links + fixed-width search pushed the
   avatar off-screen and slid the search pill over "My bets"/"Wallet".
   The nav keeps its natural width, the search pill is the part that shrinks,
   and News/Wallet (also in the account menu + balance chip) wait for 1280px. */
@media (min-width: 1100px) {
  .header-nav { flex: none; }
  .header-actions { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  .hdr-search-field { width: auto; flex: 0 1 372px; min-width: 180px; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  .header-nav .nav-wallet, .header-nav .nav-news { display: none; }
}

/* ---------- touch targets (WCAG 2.5.5 / client: >= 44px on phones) ---------- */
@media (max-width: 767px) {
  .seg-btn { min-height: 44px; }
  .fm-link { width: 44px; height: 44px; }
  .site-footer a, .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .mc-link, .view-all, .news-side .view-all { min-height: 44px; display: inline-flex; align-items: center; }
  .mc-crumbs a { min-height: 44px; display: inline-flex; align-items: center; }
  .mc-source a { display: inline-flex; align-items: center; min-height: 44px; margin: -13px 0; }
  /* links inside compact headers: grow the hit area without growing the row */
  .comp-head .comp-name, .dx-comp-name { position: relative; }
  .comp-head .comp-name::after, .dx-comp-name::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
}

/* ---------- glossary tooltips ({% term %}) ---------- */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: help; }
.term-text { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--muted); }
.term-q {
  position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--border-strong); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1;
}
.term-q::after { content: ""; position: absolute; inset: -13px; }   /* 44px hit area */
.term-q:hover, .term-q[aria-expanded="true"] { color: var(--accent-text); border-color: var(--accent); }
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.term-pop {
  position: fixed; z-index: 90; left: 0; top: 0; max-width: min(300px, calc(100vw - 24px)); padding: 10px 12px;
  border-radius: var(--r, 10px); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-pop); font-size: 13px; line-height: 19px; font-weight: 400; text-align: left;
}
.term-pop strong { display: block; margin-bottom: 2px; color: var(--text); font-size: 13px; font-weight: 600; }
.term-pop[hidden] { display: none; }
.hb-glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 12px 0 0; }
.hb-glossary > div { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r, 10px); background: var(--surface-2); scroll-margin-top: calc(var(--header-h, 64px) + 16px); }
.hb-glossary > div:target { border-color: var(--accent); }
.hb-glossary dt { font-weight: 600; color: var(--text); }
.hb-glossary dd { margin: 4px 0 0; color: var(--text-2); font-size: 14px; line-height: 21px; }

/* ---------- live: odds / scores-only view ---------- */
.fx-view { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); }
.fx-view a { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.fx-view a[aria-current="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.fx-view a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-view .icon { width: 16px; height: 16px; }
@media (max-width: 767px) { .fx-view { width: 100%; } .fx-view a { flex: 1 1 0; justify-content: center; min-height: 44px; } }
.fx-v4.is-scores .mrow-odds, .fx-v4.is-scores .mrow-side .mk, .fx-v4.is-scores .comp-cols { display: none !important; }
.fx-v4.is-scores .mrow { grid-template-columns: auto minmax(0, 1fr) auto auto !important; grid-template-areas: "time teams score side" !important; min-height: 0; padding-top: 10px; padding-bottom: 10px; }
.fx-v4.is-scores .mrow-time { grid-area: time; }
.fx-v4.is-scores .mrow-teams { grid-area: teams; }
.fx-v4.is-scores .mrow-score { grid-area: score; }
.fx-v4.is-scores .mrow-side { grid-area: side; }
.fx-v4.is-scores .mrow-score .tscore { font-size: 17px; }
.scores-note { margin: 0 0 10px; color: var(--muted); font-size: 13px; }

/* ---------- match reminders ---------- */
.remind-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--r-control, 8px); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.remind-btn .icon { width: 18px; height: 18px; color: var(--accent-text); }
.remind-btn:hover { border-color: var(--accent); }
.remind-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.remind-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.remind-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 0; }
.remind-bar .muted { font-size: 13px; }

/* ---------- favourites: my teams ---------- */
.myteam-list { display: grid; gap: 8px; }
.myteam { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-card, 12px); background: var(--surface-2); }
.myteam-name { display: block; font-weight: 600; color: var(--text); text-decoration: none; }
.myteam-name:hover { color: var(--accent-text); }
.myteam-next { display: block; color: var(--muted); font-size: 13px; line-height: 19px; }
.myteam-next a { color: var(--text-2); }
.myteam .btn { min-height: 44px; }
@media (max-width: 479px) { .myteam { grid-template-columns: auto minmax(0, 1fr); } .myteam > form, .myteam > .btn { grid-column: 1 / -1; } .myteam .btn { width: 100%; } }

/* ---------- account menu: safer-play session panel ---------- */
.menu-session { display: grid; gap: 6px; margin: 4px 0; padding: 10px 12px; border-radius: var(--r, 10px); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.menu-session-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu-session-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.menu-session .icon { width: 16px; height: 16px; color: var(--accent-text); }
.menu-session-k { display: inline-flex; align-items: center; gap: 6px; }
.menu-session a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.menu-session a:hover { text-decoration: underline; }
.menu-session .is-pos { color: var(--accent-text); } .menu-session .is-neg { color: var(--danger); }

/* ---------- share a bet ---------- */
.share-box { display: grid; gap: 12px; }
.share-url { display: flex; flex-wrap: wrap; gap: 8px; }
.share-url input { flex: 1 1 220px; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: var(--r-control, 8px); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; }
.share-url .btn { min-height: 44px; white-space: nowrap; }
.share-legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.share-leg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-card, 12px); background: var(--surface-2); }
.share-leg-sel { font-weight: 600; color: var(--text); }
.share-leg-meta { grid-column: 1 / 2; color: var(--muted); font-size: 13px; line-height: 19px; }
.share-leg-odds { grid-row: 1 / span 2; grid-column: 2; align-self: center; min-width: 64px; padding: 8px 10px; border-radius: var(--r-odds, 7px); background: var(--odds-bg); border: 1px solid var(--odds-border); color: var(--odds-text); font-weight: 700; text-align: center; }
.share-leg.is-won .share-leg-odds { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.share-leg.is-lost { opacity: .7; }
.share-sum { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0 0; border-top: 1px solid var(--border); }
.share-sum div { display: grid; }
.share-sum span { color: var(--muted); font-size: 12px; }
.share-sum b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.share-sum .is-money { color: var(--accent-text); }
.share-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ticket-share-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-card, 12px); background: var(--surface); }
.ticket-share-bar p { margin: 0; color: var(--text-2); font-size: 14px; }
.ticket-share-bar .btn { min-height: 44px; }

/* ---------- support launcher: step aside while scrolling down on phones so it never sits on an odds button ---------- */
@media (max-width: 767px) {
  .support-fab { transition: transform var(--dur-3, 200ms) var(--ease, ease), opacity var(--dur-3, 200ms) var(--ease, ease); }
  body.fab-tucked .support-fab { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
}

/* match centre: team names link to the team page (follow a team from there) */
.mc-team-link { text-decoration: none; color: inherit; }
.mc-team-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.mc-team-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* scores-only: no odds columns, so the competition name gets the whole header */
.fx-v4.is-scores .comp-card .comp-head { grid-template-columns: minmax(0, 1fr) auto; }

/* ---------- footer: lay out by the footer's own width, not the viewport ----------
   It sits in the main column, which is only ~680-760px wide at 1280-1440px when the bet slip
   column is shown, so the viewport rules squeezed the link columns to 3-28px and the text overlapped. */
.site-footer.vs-footer { container: vf / inline-size; }
@container vf (min-width: 1000px) {
  .vf-top { grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) minmax(240px, 300px); row-gap: 0; }
  .vf-links { grid-column: auto; grid-row: auto; padding: 0 28px; border-left: 1px solid var(--border-strong); border-right: 1px solid var(--border-strong); }
  .vf-region { padding-left: 28px; }
}
@container vf (max-width: 999px) {
  .vf-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 28px; }
  .vf-links { grid-column: 1 / -1; grid-row: 2; padding: 0; border: 0; }
  .vf-region { padding-left: 0; }
}
@container vf (max-width: 520px) {
  .vf-top { grid-template-columns: minmax(0, 1fr); }
  .vf-links, .vf-region { grid-column: 1; grid-row: auto; }
}

/* Lead audit 2026-11-28: long table-of-contents chips on legal pages wrap instead of overflowing at 320px. */
.legal-body .toc .chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; height: auto; min-height: 44px; }


/* Plain-language meaning of .5 lines under the selection label, e.g. 'Over 12.5' -> '13 or more sixes'. */
.odds .odds-hint { display: block; font-size: 11.5px; line-height: 1.25; color: var(--text-2, #9aa6b2); font-weight: 500; letter-spacing: 0; white-space: normal; }
.odds.is-selected .odds-hint, .odds[aria-pressed="true"] .odds-hint { color: inherit; opacity: .85; }


/* Performance: let the browser skip style/layout/paint for fixture cards and the footer while they are
   off-screen. Theme switches and page loads only restyle what is visible (the home page has ~6,000
   elements). contain-intrinsic-size keeps the scrollbar stable; "auto" remembers the real height. */
.comp-card, .site-footer { content-visibility: auto; contain-intrinsic-size: auto 320px; }
