/* ======================================================================================================
   Broadcast look for the cricket match (the "broadcast gameplay" design): a television score bar, a speed gun, result
   words as TV graphics, and a landscape layout. Loaded after style.css and ui.css, so it restyles them in place.
   ====================================================================================================== */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-600-latin.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/barlow-condensed-800-latin.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url(../fonts/barlow-condensed-800i-latin.woff2) format('woff2'); }

#match {
  --tv-font: 'Barlow Condensed', 'Arial Narrow', 'Nunito', system-ui, sans-serif;
  --tv-navy: #0b1f4a; --tv-navy2: #06142f; --tv-gold: #ffb52e; --tv-red: #e8323f; --tv-blue: #3d7bff; --tv-ink: #f4f6fa;
  --tv-h: 50px;   /* the score bar's height in landscape */
}

/* the old score tab, portraits and name bars give way to the score bar */
#match .hud-top { display: none; }

/* ---------- the score bar (js/components/tv-scorebar.js) ---------- */
.tvbar {
  position: absolute; z-index: 4; pointer-events: none; color: #fff; font-family: var(--tv-font); font-weight: 600;
  display: grid; align-items: stretch; background: linear-gradient(180deg, #102a63, var(--tv-navy)); box-shadow: 0 3px 12px #0008;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.tvbar[hidden] { display: none; }
.tvbar b { font-weight: 800; }
.tv-team { grid-area: team; display: grid; place-items: center; padding: 0 10px; background: var(--team, #1d5bd8); }
.tv-team b { font-size: 18px; letter-spacing: .04em; text-shadow: 0 1px 2px #0008; }
.tv-score { grid-area: score; display: flex; align-items: baseline; gap: 6px; padding: 0 10px; align-self: center; }
.tv-score b { font-size: 26px; line-height: 1; }
.tv-score span { font-size: 14px; opacity: .75; }
.tv-bat { grid-area: bat; display: grid; align-content: center; gap: 1px; padding: 3px 10px; border-left: 1px solid #ffffff1f; min-width: 0; }
.tv-bat > div { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; opacity: .8; white-space: nowrap; }
.tv-bat > div.on { opacity: 1; font-weight: 800; }
.tv-bat em { font-style: normal; color: var(--tv-gold); }
.tv-bat small { font-size: .85em; font-weight: 600; opacity: .65; }
.tv-bowl { grid-area: bowl; display: grid; align-content: center; gap: 2px; padding: 3px 10px; border-left: 1px solid #ffffff1f; min-width: 0; }
.tv-bowl > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; white-space: nowrap; }
.tv-over { display: flex; gap: 3px; }
.tvbar .tv-b { margin: 0; padding: 0; flex: none; }
.tv-b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ffffff26; font: 800 11px/1 var(--tv-font); font-style: normal; }
.tv-b.dot { opacity: .8; } .tv-b.nil { background: none; box-shadow: inset 0 0 0 1.5px #ffffff40; }
.tv-b.b4 { background: var(--tv-blue); } .tv-b.b6 { background: var(--tv-gold); color: #0b1020; } .tv-b.w { background: var(--tv-red); } .tv-b.ex { background: #ffffff40; font-size: 9px; }
.tv-need { grid-area: need; display: grid; align-content: center; justify-items: end; padding: 3px 12px; background: var(--tv-ink); color: #0b1020; }
.tv-need small { font-size: 10px; letter-spacing: .12em; color: #4d5a70; }
.tv-need b { font-size: 18px; white-space: nowrap; }
.tv-need.rr { background: var(--tv-navy2); color: #fff; } .tv-need.rr small { color: #ffffffa0; }

/* portrait: across the top, in two rows */
@media (orientation: portrait) {
  .tvbar { left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); grid-template-columns: auto auto 1fr auto;
    grid-template-areas: 'team score . need' 'bat bat bowl bowl'; }
  .tvbar::after { content: ''; grid-row: 2; grid-column: 1 / -1; }
  .tv-team { grid-row: 1; } .tv-need { grid-row: 1; }
  .tv-bat, .tv-bowl { background: #06142ff2; border-top: 1px solid #ffffff1a; }
  .tv-bat { border-left: 0; }
  #match #quit { top: calc(env(safe-area-inset-top) + 92px); }
}
/* landscape: one full-width bar along the bottom */
@media (orientation: landscape) {
  .tvbar { left: 0; right: 0; bottom: 0; height: calc(var(--tv-h) + env(safe-area-inset-bottom)); overflow: hidden; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    grid-template-columns: auto auto minmax(0, 1.1fr) minmax(0, 1.2fr) auto; grid-template-areas: 'team score bat bowl need'; border-top: 2px solid var(--tv-gold); }
}

/* ---------- the speed gun ---------- */
.speedgun {
  position: absolute; z-index: 4; pointer-events: none; padding: 5px 10px; text-align: right; color: #fff; font-family: var(--tv-font); line-height: 1.05;
  background: linear-gradient(180deg, #102a63, var(--tv-navy)); border: 1px solid #ffffff22; box-shadow: 0 3px 10px #0008; animation: tv-in .25s ease-out;
}
.speedgun[hidden] { display: none; }
.speedgun b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.speedgun b small { font-size: 11px; opacity: .7; }
.speedgun span { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--tv-gold); }
@media (orientation: portrait) { .speedgun { left: 8px; top: calc(env(safe-area-inset-top) + 150px); } }
@media (orientation: landscape) { .speedgun { left: calc(16px + env(safe-area-inset-left)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px); } }
@keyframes tv-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- the result as a television graphic: a slanted plate, blue for a four, gold for a six, red for out ---------- */
#match .callout { text-shadow: none; }
#match .callout b {
  display: inline-block; padding: 0 .4em; font: italic 800 56px/1.15 var(--tv-font); letter-spacing: .04em; color: #fff;
  background: var(--tv-navy); transform: skewX(-10deg); box-shadow: 0 6px 18px #0009;
}
#match .callout.four b { background: var(--tv-blue); }
#match .callout.six b { background: var(--tv-gold); color: #0b1020; }
#match .callout.out b { background: var(--tv-red); color: #fff; }
#match .callout.theirs b { background: #2a3550; }
#match .callout span {
  display: table; margin: 6px auto 0; padding: 3px 12px; font: 800 15px/1.2 var(--tv-font); letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: var(--tv-navy2); border: 1px solid #ffffff22;
}
#match .callout span:empty { display: none; }

/* a fifty or a hundred: a lower-third plate */
#match .milestone b {
  display: inline-block; padding: 0 .35em; font: italic 800 64px/1.1 var(--tv-font); color: #0b1020; -webkit-text-stroke: 0; text-shadow: none;
  background: var(--tv-gold); transform: skewX(-10deg); box-shadow: 0 6px 18px #0009;
}
#match .milestone span { border-radius: 0; background: var(--tv-navy); font: 800 16px/1.3 var(--tv-font); letter-spacing: .06em; }

/* ---------- landscape layout of the match screen ---------- */
@media (orientation: landscape) {
  /* the menu, top left */
  #match .hud-menu { --u: 0.34px; top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); }
  /* batting: who is bowling, as a compact plate top right; his variations in a row under it */
  #match .bowler-badge { top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); left: auto; width: auto; max-width: 46vw;
    display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; padding: 6px 10px; border-radius: 0;
    background: linear-gradient(180deg, #102a63, var(--tv-navy)); box-shadow: 0 3px 10px #0008; }
  #match .bowler-badge > svg:first-child, #match .bowler-badge .face { grid-row: span 2; width: 34px; height: 34px; }
  #match .bowler-badge .bb-name { font: 800 16px/1.1 var(--tv-font); }
  #match .bowler-badge .bb-kind { font: 600 12px/1.1 var(--tv-font); letter-spacing: .08em; text-transform: uppercase; }
  #match .bowler-badge .bb-desc { display: none; }
  #match .bowler-badge .bb-vars { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; margin-top: 5px; }
  #match .bowler-badge .bb-vars i { font: 600 11px/1.3 var(--tv-font); letter-spacing: .04em; border-radius: 0; padding: 2px 6px; }
  #match .bowler-badge > svg:not(:first-child) { display: none; }
  /* the tallies and the chase, top left beside the menu */
  #match .hud-info, #match:not(.bowling) .hud-info { top: calc(10px + env(safe-area-inset-top)); left: calc(64px + env(safe-area-inset-left)); right: auto; width: auto; max-width: 40vw; align-items: flex-start; }
  /* the shot buttons, bottom right above the score bar */
  #match .shot-type { right: calc(14px + env(safe-area-inset-right)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px); gap: 6px; }
  #match .shot-type button { --d: 60px; font: italic 800 12px var(--tv-font); letter-spacing: .06em; }
  /* moving across the crease, bottom left above the score bar */
  #match #bat-ctl { left: calc(16px + env(safe-area-inset-left)); transform: none; width: min(240px, 30vw); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 14px); }
  #match .speedgun { bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 76px); }
  #match .hint { bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px); }
  /* the result words: smaller, so the shot stays in view */
  #match .callout { top: 22%; }
  #match .callout b { font-size: 46px; }
  #match .milestone b { font-size: 52px; }
  #match .pressure-pill { top: calc(10px + env(safe-area-inset-top)); }

  /* bowling: the bowler's card bottom left, BOWL bottom right with the ball and the field stacked above it, all clear of the bar */
  #match:has(#bowl-ctl:not([hidden])) .hud-info, #match.bowling .hud-info, #match:has(#ball-info[hidden]) .hud-info {
    top: calc(10px + env(safe-area-inset-top)); left: calc(64px + env(safe-area-inset-left)); right: auto; align-items: flex-start; }
  #match .bowlers { left: calc(14px + env(safe-area-inset-left)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px); }
  #match .bowl { left: auto; right: calc(14px + env(safe-area-inset-right)); transform: none; bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px);
    width: 150px; height: 50px; border-width: 2px; border-radius: 6px; font: italic 800 28px/1 var(--tv-font); letter-spacing: .08em; text-shadow: 0 2px 0 #0a2d6b; }
  #match .bowl:active { transform: translateY(2px); }
  #match .ball-btn { right: calc(14px + env(safe-area-inset-right)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 74px); width: 64px; height: 50px; border-radius: 6px; }
  #match .ball-btn .ball-dot { width: 32px; height: 32px; margin: 8px auto 0; }
  #match .ball-btn b { top: -8px; right: -8px; min-width: 18px; height: 18px; font-size: 11px; border-radius: 9px; padding: 0 4px; }
  #match .field-btn { right: calc(86px + env(safe-area-inset-right)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 74px); width: 64px; height: 50px; border-radius: 6px; }
  #match .bowl-meter { --u: 0.34px; left: calc(150px + env(safe-area-inset-left)); top: calc(70px + env(safe-area-inset-top)); }
}

/* ======================================================================================================
   Football (js/football.js): the same broadcast look. A TV score bug top left with the half under the clock, the stamina
   on your man's name tag (drawn on the overlay canvas) instead of a bar at the top, the radar bottom centre in landscape,
   and the half-time stats panel.
   ====================================================================================================== */
#football { --tv-font: 'Barlow Condensed', 'Arial Narrow', 'Nunito', system-ui, sans-serif; --tv-navy: #0b1f4a; --tv-navy2: #06142f; }
#football .fb-score { height: 34px; border-radius: 0; background: linear-gradient(180deg, #102a63, var(--tv-navy)); font: 800 16px/1 var(--tv-font); letter-spacing: .04em; }
#football .fb-score .fb-t { box-shadow: none; border-left: 4px solid var(--k); }
#football .fb-score .fb-t + b { border-left: 0; }
#football .fb-score span.fb-t:last-child { border-left: 0; border-right: 4px solid var(--k); }
#football .fb-score b { min-width: 28px; font-size: 19px; background: #ffffff14; }
#football .fb-score i { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 10px; font: 800 16px/1 var(--tv-font); background: var(--tv-navy2); color: #fff; }
#football .fb-score i small { font: 600 8px/1.2 var(--tv-font); letter-spacing: .14em; opacity: .7; }
#football .fb-score .fb-tally { font-family: var(--tv-font); }
#football .fb-map { border-radius: 0; border: 1px solid #ffffff55; opacity: .92; }
#football .fb-stamina { display: none; }   /* the stamina rides on your man's name tag */
#football .fb-b span { font-family: var(--tv-font); font-style: italic; font-weight: 800; letter-spacing: .06em; }
#football .fb-banner { font-family: var(--tv-font); font-style: italic; letter-spacing: .06em; }
@media (orientation: landscape) {
  #football .fb-map { position: fixed; left: 50%; bottom: var(--padb); transform: translateX(-50%); width: 150px; height: 97px; }
  #football .fb-hint { bottom: calc(var(--padb) + 108px); }
}

/* half time */
.fb-ht { font-family: var(--tv-font); color: #fff; text-align: center; width: min(420px, 100%); margin: 0 auto; }
#fb-overlay .card:has(.fb-ht) { width: min(480px, 92vw); }
.fb-ht-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; box-shadow: 0 4px 14px #0009; }
.fb-ht-head span { display: flex; align-items: center; padding: 6px 12px; font: 800 20px/1.1 var(--tv-font); text-transform: uppercase; background: var(--k); text-shadow: 0 1px 2px #0009; }
.fb-ht-head span:first-child { justify-content: flex-end; }
.fb-ht-head b { display: grid; place-items: center; padding: 4px 14px; background: #f4f6fa; color: #0b1020; font: 800 26px/1 var(--tv-font); }
.fb-ht-head b small { font: 600 9px/1.2 var(--tv-font); letter-spacing: .14em; color: #4d5a70; }
.fb-ht-goals { display: flex; justify-content: space-between; gap: 12px; padding: 3px 12px; background: var(--tv-navy2); font: 600 13px/1.3 var(--tv-font); }
.fb-ht-stats { margin-top: 10px; padding: 10px 14px; display: grid; gap: 7px; background: linear-gradient(180deg, #102a63, var(--tv-navy)); border: 1px solid #ffffff22; }
.fb-ht-stats > small { font: 600 10px var(--tv-font); letter-spacing: .14em; opacity: .7; }
.fb-ht-row { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; font: 800 16px var(--tv-font); font-variant-numeric: tabular-nums; }
.fb-ht-row b:first-child { text-align: left; } .fb-ht-row b:last-child { text-align: right; }
.fb-ht-row > div { display: grid; gap: 2px; }
.fb-ht-row span { font: 600 11px var(--tv-font); letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.fb-ht-row i { display: flex; height: 5px; }
.fb-ht-row s { display: block; height: 100%; }

/* ======================================================================================================
   Bowling: the pitch map (js/match.js drawPitchMap). Line and length from above, the batter's end at the top; tap or drag.
   ====================================================================================================== */
.pitchmap {
  position: absolute; z-index: 3; width: 96px; padding: 6px 6px 7px; display: grid; gap: 4px; justify-items: center; pointer-events: auto; touch-action: none;
  background: linear-gradient(180deg, #102a63e6, #0b1f4ae6); border: 1px solid #ffffff26; box-shadow: 0 3px 12px #0008; color: #fff; font-family: var(--tv-font);
}
.pitchmap[hidden] { display: none; }
.pitchmap small { font: 600 9px/1 var(--tv-font); letter-spacing: .14em; opacity: .8; }
.pitchmap svg { display: block; width: 84px; height: 168px; cursor: crosshair; }
.pitchmap b { font: 800 11px/1.1 var(--tv-font); letter-spacing: .04em; color: var(--tv-gold); text-align: center; }
#match:has(#bowl-meter:not([hidden])) .pitchmap { pointer-events: none; opacity: .85; }   /* fixed once BOWL is pressed */
@media (orientation: portrait) { .pitchmap { right: 8px; top: calc(env(safe-area-inset-top) + 140px); } }
@media (orientation: landscape) { .pitchmap { right: calc(14px + env(safe-area-inset-right)); top: calc(10px + env(safe-area-inset-top)); padding: 4px 6px 5px; }
  .pitchmap svg { width: 64px; height: 128px; } }

/* ======================================================================================================
   LBW: the on-field decision and the decision review as television graphics.
   ====================================================================================================== */
#match .appeal { font-family: var(--tv-font); }
#match .ap-ump { border-radius: 0; background: linear-gradient(180deg, #102a63f2, #0b1f4af2); border: 1px solid #ffffff2e; }
#match .ap-ump small { font: 600 12px var(--tv-font); letter-spacing: .16em; }
#match .ap-ump > b { font: italic 800 40px/1 var(--tv-font); letter-spacing: .04em; }
#match .ap-review { border-radius: 4px; font: italic 800 18px var(--tv-font); letter-spacing: .08em; }
#match .ap-accept { border-radius: 4px; font: 600 14px var(--tv-font); letter-spacing: .04em; }
#match .ap-tag { top: calc(10px + env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; gap: 10px; padding: 5px 12px; border-radius: 0;
  background: linear-gradient(180deg, #102a63, var(--tv-navy)); border: 1px solid #ffffff26; letter-spacing: 0; font-weight: 600; box-shadow: 0 3px 10px #0008; }
#match .ap-tag b { font: 800 15px var(--tv-font); letter-spacing: .1em; }
#match .ap-tag span { font: 600 12px var(--tv-font); letter-spacing: .06em; opacity: .75; text-transform: uppercase; }
/* the three readings, stacked on the right like the broadcast boxes */
#match .appeal ul.ap-boxes { left: auto; right: calc(12px + env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); width: 132px; padding: 0; gap: 5px; background: none; border-radius: 0; }
#match .ap-boxes li { display: block; padding: 5px 9px; color: #062213; background: var(--go, #2fd27a); box-shadow: 0 3px 10px #0008; }
#match .ap-boxes li.no { background: var(--tv-red); color: #fff; }
#match .ap-boxes li.call { background: var(--tv-gold); color: #0b1020; }
#match .ap-boxes li small { display: block; font: 600 9px/1.2 var(--tv-font); letter-spacing: .14em; opacity: .8; }
#match .ap-boxes li b { font: 800 16px/1.1 var(--tv-font); color: inherit; }
/* the call: a white plate, OUT in red or NOT OUT in green, and what became of the on-field decision */
#match .ap-verdict { top: auto; bottom: 24%; left: 0; right: 0; margin: 0 auto; width: fit-content; transform: none; animation: tv-in .3s ease-out both; padding: 4px 26px 6px; background: #f4f6fa; color: #2fbf55; -webkit-text-stroke: 0;
  text-shadow: none; font: italic 800 52px/1 var(--tv-font); letter-spacing: .04em; box-shadow: 0 8px 22px #000a; white-space: nowrap; }
#match .ap-verdict.out { color: var(--tv-red); }
#match .ap-verdict small { margin-top: 2px; font: 600 11px var(--tv-font); letter-spacing: .14em; color: #4d5a70; }
@media (orientation: landscape) { #match .ap-verdict { bottom: calc(var(--tv-h) + 24px); font-size: 44px; } }
@media (orientation: portrait) { #match .ap-tag { top: calc(env(safe-area-inset-top) + 98px); } }

/* ======================================================================================================
   Closer to the broadcast design: a photographic grade on the 3D view, the channel tag, the ball tracker riding on the
   ball, and the time-to-bat countdown top right.
   ====================================================================================================== */
/* the grade: a touch more contrast, less saturation and a warm cast, as the design's frames; a soft vignette and grain */
#match #gl { filter: contrast(1.1) saturate(.8) brightness(.97) sepia(.06); }
#match .vignette { background: radial-gradient(120% 90% at 50% 45%, #0000 55%, #000a 100%); }
#match .vignette::after { content: ''; position: absolute; inset: 0; opacity: .14; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E"); }

/* the channel tag */
.tvbug { position: absolute; z-index: 4; display: flex; align-items: center; gap: 6px; pointer-events: none; font-family: var(--tv-font); text-shadow: 0 1px 3px #000; }
.tvbug[hidden] { display: none; }
.tvbug b { padding: 0 6px; background: var(--tv-red); color: #fff; font: 800 12px/1.5 var(--tv-font); letter-spacing: .12em; text-shadow: none; }
.tvbug span { font: 600 12px var(--tv-font); letter-spacing: .1em; text-transform: uppercase; color: #fff; }
@media (orientation: landscape) { .tvbug { left: calc(62px + env(safe-area-inset-left)); top: calc(18px + env(safe-area-inset-top)); }
  #match .hud-info, #match:not(.bowling) .hud-info, #match:has(#bowl-ctl:not([hidden])) .hud-info, #match.bowling .hud-info, #match:has(#ball-info[hidden]) .hud-info { top: calc(44px + env(safe-area-inset-top)); } }
@media (orientation: portrait) { .tvbug { left: 62px; top: calc(env(safe-area-inset-top) + 100px); } }

/* the ball tracker: the speed plate rides beside the ball in flight, with a ring on the ball */
#match .speedgun.track { left: var(--x) !important; top: var(--y) !important; bottom: auto !important; right: auto !important;
  transform: translate(26px, -50%); animation: none; padding: 3px 8px; }
#match .speedgun.track b { font-size: 16px; } #match .speedgun.track span { font-size: 9px; }
#match .speedgun.track::before { content: ''; position: absolute; left: -38px; top: 50%; width: 22px; height: 22px; margin-top: -12px; border: 2px solid var(--tv-gold); border-radius: 50%; }
#match .speedgun.track::after { content: ''; position: absolute; left: -14px; top: 50%; width: 14px; height: 1.5px; background: var(--tv-gold); }

/* time to bat, top right */
.tvtime { position: absolute; z-index: 4; width: 190px; pointer-events: none; font-family: var(--tv-font); color: #fff; text-shadow: 0 1px 3px #000; --k: 0;
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.tvtime[hidden] { display: none; }
.tvtime span { font: 600 10px var(--tv-font); letter-spacing: .14em; }
.tvtime b { font: 800 11px var(--tv-font); letter-spacing: .06em; text-align: right; font-variant-numeric: tabular-nums; }
.tvtime i { grid-column: 1 / -1; position: relative; height: 7px; margin-top: 3px; border-radius: 99px;
  background: linear-gradient(90deg, #ffffff33 0 62%, #ffb52e 62% 72%, #2fd27a 72% 88%, #ffb52e 88% 94%, #ffffff33 94%); }
.tvtime s { position: absolute; top: -4px; left: calc(var(--k) * 100%); width: 3px; height: 15px; margin-left: -1.5px; background: #fff; border-radius: 2px; box-shadow: 0 0 6px #000; }
@media (orientation: landscape) { .tvtime { right: calc(16px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top)); }
  /* the design keeps the top right clear for the timing; the bowler is in the score bar, the coming delivery in the speed plate */
  #match .bowler-badge { display: none !important; } }
@media (orientation: portrait) { .tvtime { right: 8px; top: calc(env(safe-area-inset-top) + 100px); width: 160px; } }

/* ======================================================================================================
   Batting and bowling to the broadcast design (cricket, TV camera style)
   ====================================================================================================== */
/* the read (length and line) on the ball tracker plate */
#match .speedgun em { display: block; font: 600 10px/1.2 var(--tv-font); font-style: normal; letter-spacing: .06em; color: #fff; opacity: .85; }

/* the aim stick, bottom left */
.bat-stick { position: absolute; z-index: 3; width: 108px; height: 108px; border-radius: 50%; touch-action: none; pointer-events: auto;
  background: #05080d66; border: 2px solid #ffffff40; display: grid; place-items: center; }
.bat-stick[hidden] { display: none; }
.bat-stick i { width: 42px; height: 42px; border-radius: 50%; background: #f4f6fae6; box-shadow: 0 2px 8px #0008; transition: transform .06s; pointer-events: none; }
.bat-stick b { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); white-space: nowrap; font: 600 10px var(--tv-font); letter-spacing: .12em; color: #fff; text-shadow: 0 1px 3px #000; }

/* the shot buttons as the design draws them: flat, round, LOFT in gold, the rest glass */
#match .shot-type button { background: #05080db3; border: 1px solid #ffffff38; box-shadow: 0 3px 10px #0008; font: italic 800 12px var(--tv-font); letter-spacing: .06em; }
#match .shot-type button svg { width: 34%; height: 34%; min-width: 18px; min-height: 18px; }
#match .shot-type button[data-shot="loft"] { background: var(--tv-gold); color: #0b1020; border-color: #ffffff66; }
#match .shot-type button[data-shot="loft"] svg { stroke: #0b1020; }
#match .shot-type button.on { background: #2fd27a; color: #062213; border: 2px solid #fff; transform: none; box-shadow: 0 0 0 3px #2fd27a55, 0 3px 10px #0008; }
#match .shot-type button.on svg { stroke: #062213; }
#match .shot-type button.on::after { content: none; }
#match .shot-type button[data-shot="leave"] { grid-area: leave; }
#match .shot-type { grid-template-columns: repeat(2, auto); grid-template-areas: 'defend leave' 'drive loft'; }
#match .shot-type button[data-shot="leave"][hidden] { display: none; }

@media (orientation: landscape) {
  #match .bat-stick { left: calc(22px + env(safe-area-inset-left)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 30px); }
  /* the crease bar: slim, bottom centre, just above the score bar */
  #match:has(#bat-stick:not([hidden])) #bat-ctl { left: 50%; transform: translateX(-50%); width: min(220px, 26vw); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 6px); opacity: .85; }
  #match .shot-type button { --d: 58px; }
  #match .shot-type button[data-shot="loft"] { --d: 70px; }
  #match .shot-type button[data-shot="leave"] { --d: 48px; justify-self: start; align-self: end; }
  #match .shot-type button[data-shot="defend"] { --d: 50px; justify-self: end; align-self: end; }
  #match .speedgun:not(.track) em { display: none; }
}
@media (orientation: portrait) {
  #match .bat-stick { left: 14px; bottom: calc(env(safe-area-inset-bottom) + 96px); width: 92px; height: 92px; }
}

/* ---------- bowling ---------- */
.bowl-plan { position: absolute; z-index: 3; pointer-events: none; padding: 4px 11px; border-radius: 99px; background: #05080db8; border: 1px solid #ffffff22;
  font: 600 12px var(--tv-font); letter-spacing: .03em; color: #fff; white-space: nowrap; }
.bowl-plan[hidden], .deliv-list[hidden] { display: none; }
.bowl-plan b { color: var(--tv-gold); font-weight: 800; letter-spacing: .1em; margin-right: 4px; }
.deliv-list { position: absolute; z-index: 3; display: grid; gap: 5px; width: 168px; pointer-events: auto; font-family: var(--tv-font); }
.deliv-list small { font: 600 9px var(--tv-font); letter-spacing: .14em; color: #fff; text-shadow: 0 1px 3px #000; }
.deliv-list button { display: grid; gap: 1px; text-align: left; padding: 5px 9px; border: 1px solid #ffffff22; border-radius: 6px; background: #05080db8; color: #fff; cursor: pointer; }
.deliv-list button b { font: 800 13px var(--tv-font); letter-spacing: .04em; }
.deliv-list button span { font: 600 10px var(--tv-font); opacity: .7; }
.deliv-list button.on { background: var(--tv-gold); color: #0b1020; border-color: transparent; }
.deliv-list button:active { transform: translateY(1px); }

@media (orientation: landscape) {
  /* the bowler as a plate top left, under the channel tag (tap it for the full bowling sheet: field, side, change bowler) */
  #match:has(#deliv-list:not([hidden])) .bowlers { left: calc(14px + env(safe-area-inset-left)); top: calc(44px + env(safe-area-inset-top)); bottom: auto; }
  #match:has(#deliv-list:not([hidden])) .bcard { flex-direction: row; width: auto; padding: 4px 10px 4px 4px; gap: 8px; border-radius: 0; border: 1px solid #ffffff26;
    background: linear-gradient(180deg, #102a63, var(--tv-navy)); box-shadow: 0 3px 10px #0008; }
  #match:has(#deliv-list:not([hidden])) .bcard .bface { width: 34px; height: 34px; border-width: 2px; box-shadow: none; }
  #match:has(#deliv-list:not([hidden])) .bcard .bst { position: static; order: 3; }
  #match:has(#deliv-list:not([hidden])) .bcard .bicons { display: none; }
  #match:has(#deliv-list:not([hidden])) .bcard .bvary { position: static; transform: none; order: 2; }
  #match .bowl-plan { left: calc(14px + env(safe-area-inset-left)); top: calc(90px + env(safe-area-inset-top)); }
  #match .deliv-list { right: calc(14px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); }
  /* the pitch map, bottom left */
  #match:has(#deliv-list:not([hidden])) .pitchmap { right: auto; top: auto; left: calc(14px + env(safe-area-inset-left)); bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 12px); }
  /* BOWL: a round white button, bottom right; the ball and the side of the wicket as small glass buttons beside it */
  #match:has(#deliv-list:not([hidden])) .bowl { width: 84px; height: 84px; border-radius: 50%; border: 0; background: #f4f6fae6; color: #0b1020; text-shadow: none;
    font: italic 800 20px/1 var(--tv-font); box-shadow: 0 0 0 6px #ffffff2e, 0 4px 12px #0008; }
  #match:has(#deliv-list:not([hidden])) .ball-btn, #match:has(#deliv-list:not([hidden])) .field-btn { width: 46px; height: 40px; bottom: calc(var(--tv-h) + env(safe-area-inset-bottom) + 18px); border-radius: 6px; }
  #match:has(#deliv-list:not([hidden])) .ball-btn { right: calc(112px + env(safe-area-inset-right)); }
  #match:has(#deliv-list:not([hidden])) .ball-btn .ball-dot { width: 24px; height: 24px; margin-top: 7px; }
  #match:has(#deliv-list:not([hidden])) .field-btn { right: calc(164px + env(safe-area-inset-right)); }
  /* the scouting chips give way to the PLAN; the chase is in the score bar */
  #match:has(#deliv-list:not([hidden])) .hud-info { display: none; }
}
@media (orientation: portrait) {
  /* portrait: the same broadcast layout as landscape and desktop, arranged for a tall screen */
  #match.tv .bowlers { left: 10px; top: calc(env(safe-area-inset-top) + 236px); bottom: auto; }
  #match.tv .bcard { flex-direction: row; width: auto; padding: 4px 10px 4px 4px; gap: 8px; border-radius: 0; border: 1px solid #ffffff26;
    background: linear-gradient(180deg, #102a63, var(--tv-navy)); box-shadow: 0 3px 10px #0008; }
  #match.tv .bcard .bface { width: 34px; height: 34px; border-width: 2px; box-shadow: none; }
  #match.tv .bcard .bst { position: static; order: 3; }
  #match.tv .bcard .bicons { display: none; }
  #match.tv .bcard .bvary { position: static; transform: none; order: 2; }
  #match .bowl-plan { left: 10px; top: calc(env(safe-area-inset-top) + 284px); max-width: calc(100vw - 132px); white-space: normal; border-radius: 12px; line-height: 1.3; }
  #match.tv .pitchmap { right: 8px; top: calc(env(safe-area-inset-top) + 236px); }
  /* the deliveries: a row of three above the controls */
  #match .deliv-list { left: 10px; right: 10px; width: auto; bottom: calc(env(safe-area-inset-bottom) + 118px); grid-template-columns: repeat(3, 1fr); }
  #match .deliv-list small { grid-column: 1 / -1; }
  #match .deliv-list button span { display: none; }
  #match .deliv-list button { text-align: center; padding: 7px 4px; }
  /* BOWL round, bottom right; the ball and the side of the wicket small beside it */
  #match.tv .bowl { left: auto; right: 14px; transform: none; bottom: calc(env(safe-area-inset-bottom) + 18px); width: 84px; height: 84px; border-radius: 50%; border: 0;
    background: #f4f6fae6; color: #0b1020; text-shadow: none; font: italic 800 20px/1 var(--tv-font); letter-spacing: .06em; box-shadow: 0 0 0 6px #ffffff2e, 0 4px 12px #0008; }
  #match.tv .bowl:active { transform: translateY(2px); }
  #match.tv .ball-btn, #match.tv .field-btn { width: 46px; height: 40px; bottom: calc(env(safe-area-inset-bottom) + 40px); border-radius: 6px; }
  #match.tv .ball-btn { right: 112px; } #match.tv .ball-btn .ball-dot { width: 24px; height: 24px; margin-top: 7px; }
  #match.tv .ball-btn b { top: -8px; right: -8px; min-width: 18px; height: 18px; font-size: 11px; border-radius: 9px; padding: 0 4px; }
  #match.tv .field-btn { right: 164px; }
  #match.tv.bowling .hud-info { display: none; }
  #match.tv .bowl-meter { --u: 0.34px; left: 12px; top: calc(env(safe-area-inset-top) + 330px); }
}
/* the TV style, everywhere: the bowler's own panel gives way (he is in the score bar, the coming delivery on the ball tracker) */
#match.tv .bowler-badge { display: none !important; }
@media (orientation: landscape) { #match.tv.bowling .hud-info { display: none; } }   /* bowling: the PLAN in place of the scouting chips */
@media (orientation: portrait) { #match .tvtime { top: calc(env(safe-area-inset-top) + 132px); } }
#match .speedgun.track.tv-left { transform: translate(calc(-100% - 26px), -50%); text-align: left; }
#match .speedgun.track.tv-left::before { left: auto; right: -38px; }
#match .speedgun.track.tv-left::after { left: auto; right: -14px; }

/* ---------- bigger screens (tablets, laptops, desktops): the broadcast graphics scale with the screen's height, so they keep the
   proportions they have on a phone in landscape (393 px tall) instead of shrinking into the corners. The ball tracker is left out:
   it is placed on the ball in screen pixels. ---------- */
@media (orientation: landscape) and (min-height: 520px) { #match.tv { --hs: 1.3; } }
@media (orientation: landscape) and (min-height: 680px) { #match.tv { --hs: 1.6; } }
@media (orientation: landscape) and (min-height: 860px) { #match.tv { --hs: 1.95; } }
@media (orientation: landscape) and (min-height: 1050px) { #match.tv { --hs: 2.3; } }
#match.tv :is(.tvbar, .tvbug, .tvtime, .pitchmap, .bowl-plan, .deliv-list, .bowlers, .bowl, .ball-btn, .field-btn, .shot-type, .bat-stick, #bat-ctl, .hud-menu, .callout, .milestone, .appeal, .bowl-meter) { zoom: var(--hs, 1); }
/* short portrait phones: a smaller pitch map, so it stays off the pitch */
@media (orientation: portrait) and (max-height: 720px) { #match.tv .pitchmap svg { width: 56px; height: 112px; } #match.tv .pitchmap { width: 80px; } }
#match.tv .speedgun:not(.track) { zoom: var(--hs, 1); }
/* short landscape phones: a shorter bowling meter, clear of the score bar */
@media (orientation: landscape) and (max-height: 380px) { #match .bowl-meter { --u: 0.29px; top: calc(62px + env(safe-area-inset-top)); } }
#match .speedgun em, #match .speedgun span { white-space: nowrap; }

/* ======================================================================================================
   Watching and betting (js/ui.js): the live list's filters and tags, and the odds beside the stream rather than over it
   ====================================================================================================== */
.live-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.live-filters small { opacity: .75; margin-left: 2px; }
.live-item p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.live-tag, .kind-tag { padding: 1px 7px; border-radius: 4px; font: 800 10px/1.6 'Barlow Condensed', 'Arial Narrow', sans-serif; letter-spacing: .1em; }
.live-tag { background: #c8102e; color: #fff; }
.live-tag.ball { background: #ffb52e; color: #2e1d00; }
.kind-tag { background: #ffffff1f; color: #dbe6ff; }
.kind-tag.bot { background: #3d7bff33; color: #9dbbff; }
.kind-tag.friend { background: #2fd27a33; color: #7ef0ae; }
.watchers { font-size: 12px; color: var(--muted, #9bb0dc); }

/* LIVE · WATCHING and BET: above the score bar in landscape */
@media (orientation: landscape) { #match.tv .spec-bar { bottom: calc(62px + env(safe-area-inset-bottom)); } }
/* The odds while watching: the match keeps playing in view. Landscape: a panel down the right, clear of the score bar;
   portrait: a sheet over the bottom half, the pitch above it. Taps outside it go to the match (the panel closes with Back). */
#modal.over-match { background: transparent; pointer-events: none; }
#modal.over-match .sheet { pointer-events: auto; box-shadow: 0 0 0 1px #ffffff1a, 0 10px 30px #000a; }
@media (orientation: landscape) {
  #modal.over-match { place-items: start end; padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 0 0; }
  #modal.over-match .sheet { width: min(380px, 44vw); max-width: none; max-height: calc(100dvh - 72px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 14px; }
}
@media (orientation: portrait) { #modal.over-match .sheet { max-height: 50dvh; } }

/* Watching without an account: the call to sign in to bet (the Online tab, and the odds sheet) */
.signin-cta { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: linear-gradient(90deg, #ffb52e26, #ffb52e0d); border: 1px solid #ffb52e59; }
.signin-cta > div { flex: 1; min-width: 0; }
.signin-cta h3 { margin: 0 0 2px; font-size: 16px; }
.signin-cta p { margin: 0; color: var(--muted, #9bb0dc); font-size: 13px; }
/* the football sheet: the score as the stream shows it */
.w-fb { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 8px; font: 800 17px 'Barlow Condensed', 'Arial Narrow', sans-serif; }
.w-fb span:last-child { text-align: right; }
.w-fb b { font-size: 30px; padding: 2px 12px; border-radius: 8px; background: #06142f; color: #fff; }

/* Watching a football match (js/football.js watch): no controls, the LIVE and BET bar bottom right */
#football.watching .fb-btns, #football.watching #fb-stick, #football.watching #fb-touch, #football.watching #fb-stamina, #football.watching #fb-hint { display: none !important; }
#football #fb-spec { z-index: 6; right: calc(12px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); }
