/* ==========================================================================
   Live scoring: tracker (phones/tablets), TV scoreboard, live cards/pages
   ========================================================================== */

/* --- Shared --------------------------------------------------------------- */

.live-dot {
  display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--red-600);
  box-shadow: 0 0 0 0 rgba(228,0,43,.6); animation: live-pulse 1.6s infinite; vertical-align: .05em;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(228,0,43,.55); }
  70% { box-shadow: 0 0 0 .5em rgba(228,0,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(228,0,43,0); }
}
.live-status {
  display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em;
  font-weight: 600; color: var(--red-600); margin-right: .5rem;
}
.live-status.is-final { color: var(--text-muted); }
.live-status.is-final .live-dot { display: none; }
.hero .live-status { color: #ff6b84; }
.hero .live-status.is-final { color: #c4d5ea; }
.hero__kicker [data-meta]:not(:empty)::before { content: "· "; }

.bump { animation: bump .6s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); color: var(--sky-400); }
  100% { transform: scale(1); }
}
.avatar--empty { display: inline-block; }

/* Point list (public page, TV, game history) */
.pt-list { list-style: none; margin: 0; padding: 0; }
.pt { display: grid; grid-template-columns: 3.6rem auto 1fr auto; align-items: center; gap: .85rem; padding: .7rem 1.4rem; border-bottom: 1px solid var(--border); }
.pt:last-child { border-bottom: 0; }
.pt--1 { box-shadow: inset 4px 0 0 var(--navy-700); }
.pt--2 { box-shadow: inset 4px 0 0 var(--red-600); }
.pt__score { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pt__how { color: var(--text-muted); font-size: .92rem; }
.pt__how.is-topper { color: #a06d00; font-weight: 700; }
.pt__time { color: var(--text-faint); font-size: .88rem; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.pt__ago { font-size: .78em; opacity: .65; }
.pt.is-fresh { animation: fresh 2.5s ease; }
@keyframes fresh { 0% { background: rgba(65,182,230,.35); } 100% { background: transparent; } }
@media (prefers-color-scheme: dark) { .pt--1 { box-shadow: inset 4px 0 0 var(--sky-500); } .pt__how.is-topper { color: var(--gold-500); } }

/* Score chart */
.chart { width: 100%; height: auto; display: block; }
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__ten { stroke: var(--gold-500); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart__label { fill: var(--text-faint); font: 600 11px var(--font-body); }
.chart__line { fill: none; stroke-width: 3.5; stroke-linejoin: round; }
.chart__line--1 { stroke: var(--navy-700); }
.chart__line--2 { stroke: var(--red-600); }
@media (prefers-color-scheme: dark) { .chart__line--1 { stroke: var(--sky-500); } }

.live-clock { margin-top: 1rem; color: #c4d5ea; display: flex; align-items: center; gap: .5rem; justify-content: center; font-size: 1rem; }
.live-clock strong { font-family: var(--font-display); font-size: 1.3rem; color: #fff; font-variant-numeric: tabular-nums; }
.scoreboard__faces { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.scoreboard__team--right .scoreboard__faces { justify-content: flex-end; }
.scoreboard__names { flex-basis: 100%; font-weight: 700; font-size: 1.25rem; color: #fff; }
@media (max-width: 640px) { .scoreboard__faces { justify-content: center; } }

/* --- Live cards (home page, /live) ---------------------------------------- */

.live-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.live-cards .empty { grid-column: 1 / -1; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.live-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border-top: 4px solid var(--red-600); }
.live-card.is-final { border-top-color: var(--border-strong); }
.live-card__top { display: flex; align-items: center; gap: .6rem; padding: .75rem 1.1rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
.live-card__event { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card__clock { font-family: var(--font-display); font-size: 1.05rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.live-card__team { display: flex; align-items: center; gap: .4rem; padding: .6rem 1.1rem; }
.live-card__names { flex: 1; min-width: 0; margin-left: .35rem; font-weight: 600; color: var(--text-muted); }
.live-card__score { font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; line-height: 1; color: var(--text-faint); }
.live-card__team.is-leading .live-card__names { color: var(--text); }
.live-card__team.is-leading .live-card__score { color: var(--text); }
.live-card__last { padding: .55rem 1.1rem; font-size: .9rem; color: var(--text-muted); background: var(--surface-2); border-top: 1px solid var(--border); }
.live-card__actions { display: flex; gap: .5rem; flex-wrap: wrap; padding: .75rem 1.1rem; border-top: 1px solid var(--border); }

/* Nav "Live" link */
.site-nav__links a .live-dot { margin-left: .35rem; width: .5em; height: .5em; }

/* --- Tracker -------------------------------------------------------------- */

.app-body { min-height: 100vh; display: block; }
.app-body.is-tracker { background: var(--bg); }
html.has-sheet, html.has-sheet body { overflow: hidden; }

.trk { min-width: 0; margin: 0 auto; padding: 0 0 calc(2rem + env(safe-area-inset-bottom)); }
.trk-bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem;
  padding: calc(.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .5rem max(1rem, env(safe-area-inset-left));
  background: var(--navy-900); color: #fff;
}
.trk-bar__back { display: inline-flex; align-items: center; gap: .3rem; color: #d4e3f5; text-decoration: none; font-weight: 600; min-height: 44px; }
.trk-bar__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.trk-bar__event { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-bar__meta { font-size: .78rem; color: #9fb3cc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trk-bar__meta .setup { flex-wrap: nowrap; gap: .6rem; }
.trk-bar__meta .setup__item { gap: .3rem; }
.trk-bar__menu { background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 10px; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.trk-sync { font-size: .78rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
.trk-sync.is-ok { background: rgba(52,199,105,.18); color: #7ff0a6; }
.trk-sync.is-busy { background: rgba(255,255,255,.12); color: #d4e3f5; }
.trk-sync.is-bad { background: rgba(255,92,120,.25); color: #ffb3c0; }

.trk-board {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .5rem;
  padding: .75rem 1rem 1rem; background: linear-gradient(180deg, var(--navy-900), var(--navy-800)); color: #fff;
}
.trk-board__team { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.trk-board__names { font-size: .85rem; color: #b9cbe2; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-board__score { font-family: var(--font-display); font-weight: 700; font-size: clamp(3.5rem, 16vw, 6rem); line-height: 1; color: rgba(255,255,255,.55); font-variant-numeric: tabular-nums; }
.trk-board__team.is-leading .trk-board__score { color: #fff; }
.trk-board__mid { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.trk-board__clock { font-family: var(--font-display); font-size: 1.15rem; color: #c4d5ea; font-variant-numeric: tabular-nums; }
.trk-board__situation { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 6px; }
.trk-board__situation.is-on { background: var(--gold-500); color: #3a2a00; }

.trk-banner {
  margin: .75rem 1rem 0; padding: .75rem 1rem; border-radius: 12px; background: rgba(242,176,30,.15); border: 1px solid rgba(242,176,30,.5);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem;
}
.trk-banner.is-strong { background: var(--surface); border: 2px solid var(--border-strong); }
.trk-hint { margin: .85rem 1rem 0; color: var(--text-muted); font-size: .95rem; text-align: center; }

.trk-players { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; padding: .75rem 1rem 0; }
.trk-team { display: grid; gap: .6rem; align-content: start; min-width: 0; }
.trk-team__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--text-muted); text-align: center; }
.trk-player {
  display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: 1rem .5rem .85rem; border-radius: 16px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text); font: inherit;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; min-height: 150px; position: relative;
}
.trk-team--1 .trk-player { border-top: 5px solid var(--navy-700); }
.trk-team--2 .trk-player { border-top: 5px solid var(--red-600); }
.trk-player:active { transform: scale(.97); background: var(--surface-2); }
.trk-player[disabled] { opacity: .55; cursor: default; transform: none; }
.trk-player .avatar--lg { width: 64px; height: 64px; }
.trk-player__text { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.trk-player__nick { font-weight: 700; font-size: 1.1rem; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.trk-player__line { font-size: .8rem; color: var(--text-muted); text-align: center; }
.trk-player__rating {
  position: absolute; top: .5rem; right: .5rem; font-family: var(--font-display); font-size: .9rem; padding: .05rem .45rem;
  border-radius: 999px; background: var(--surface-3); color: var(--text-muted);
}

.trk-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; padding: 1rem; }
.trk-actions .btn { width: 100%; white-space: normal; text-align: center; line-height: 1.15; }

.trk-log { margin: 0 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.trk-log__title { margin: 0; padding: .85rem 1.1rem; font-size: 1.2rem; border-bottom: 1px solid var(--border); }
.trk-log__list { list-style: none; margin: 0; padding: 0; }
.trk-log__list li + li { border-top: 1px solid var(--border); }
.trk-log__empty { padding: 1rem 1.1rem; margin: 0; }
.trk-point {
  width: 100%; display: grid; grid-template-columns: 2rem auto 1fr auto; align-items: center; gap: .7rem; padding: .7rem 1.1rem;
  background: none; border: 0; text-align: left; font: inherit; color: var(--text); cursor: pointer; touch-action: manipulation;
}
.trk-point:active { background: var(--surface-2); }
.trk-point--1 { box-shadow: inset 4px 0 0 var(--navy-700); }
.trk-point--2 { box-shadow: inset 4px 0 0 var(--red-600); }
.trk-point.is-pending { opacity: .7; }
.trk-point__num { font-family: var(--font-display); color: var(--text-faint); text-align: center; }
.trk-point__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.trk-point__how { font-size: .85rem; color: var(--text-muted); }
.trk-point__how.is-topper { color: #a06d00; font-weight: 700; }
.trk-point__score { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .trk-team--1 .trk-player, .trk-point--1 { border-top-color: var(--sky-500); } .trk-point--1 { box-shadow: inset 4px 0 0 var(--sky-500); } .trk-point__how.is-topper { color: var(--gold-500); } }

/* Tablets: players + controls on the left, point log on the right */
@media (min-width: 900px) {
  .trk { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "bar bar" "board board" "banner banner" "hint log" "players log" "actions log"; align-items: start; column-gap: 1rem; }
  .trk-bar { grid-area: bar; }
  .trk-board { grid-area: board; }
  .trk-banner { grid-area: banner; }
  .trk-hint { grid-area: hint; }
  .trk-players { grid-area: players; padding-right: 0; }
  .trk-actions { grid-area: actions; padding-right: 0; }
  .trk-log { grid-area: log; margin: .85rem 1rem 0 0; max-height: calc(100vh - 260px); overflow-y: auto; }
  .trk-player { min-height: 190px; }
  .trk-player .avatar--lg { width: 84px; height: 84px; }
  .trk-player__nick { font-size: 1.3rem; }
}

/* Bottom sheet */
.sheet-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(6,18,36,.55); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.3);
  padding-bottom: env(safe-area-inset-bottom); animation: sheet-in .2s ease;
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .sheet { left: 50%; right: auto; width: 620px; transform: translateX(-50%); bottom: 2rem; border-radius: 20px; animation: none; } }
.sheet__inner { padding: 1.1rem 1.1rem 1.25rem; display: grid; gap: 1rem; }
.sheet__head { display: flex; align-items: center; gap: .85rem; }
.sheet__kicker { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; color: var(--text-muted); }
.sheet__title { margin: 0; font-size: 1.6rem; }
.sheet__body { display: grid; gap: .75rem; }
.sheet__label { font-weight: 700; font-size: .95rem; color: var(--text-muted); margin-top: .25rem; }
.sheet__section { margin: .75rem 0 0; font-size: 1.1rem; }
.sheet__foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.sheet__foot .btn { white-space: normal; }
.sheet__cancel { width: 100%; }
.stack-sm > * + * { margin-top: .6rem; }
.btn--block { width: 100%; }
.btn small { font-weight: 500; opacity: .85; margin-left: .25rem; }
.link-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.outcome {
  display: flex; align-items: center; gap: .85rem; width: 100%; min-height: 68px; padding: .75rem 1rem; border-radius: 14px; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--border); color: var(--text); font: inherit; text-align: left; touch-action: manipulation;
}
.outcome:active { transform: scale(.98); }
.outcome span { display: flex; flex-direction: column; line-height: 1.2; }
.outcome strong { font-size: 1.15rem; }
.outcome small { color: var(--text-muted); font-size: .85rem; }
.outcome__icon { font-size: 1.6rem; width: 46px; height: 46px; display: grid !important; place-items: center; border-radius: 50%; background: var(--surface-3); font-family: var(--font-display); font-weight: 700; }
.outcome--topper { background: rgba(242,176,30,.14); border-color: rgba(242,176,30,.55); }
.outcome--topper .outcome__icon { background: rgba(242,176,30,.3); }
.outcome--plain { min-height: 48px; justify-content: center; background: transparent; border-style: dashed; color: var(--text-muted); font-weight: 600; }
.outcome--plain small { margin-left: .35rem; }
.outcome.is-selected { border-color: var(--sky-500); box-shadow: 0 0 0 3px rgba(65,182,230,.3); }
.outcome-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
.outcome { min-width: 0; }
.outcome strong { overflow-wrap: anywhere; }
.outcome-grid .outcome--split { grid-column: 1 / -1; min-height: 56px; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem .35rem .35rem; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--border); font: 600 .95rem var(--font-body); color: var(--text); min-height: 44px;
}
.chip-btn.is-selected { border-color: var(--sky-500); background: rgba(65,182,230,.12); }

.final-score { display: grid; gap: .35rem; font-size: 1.1rem; }
.final-score span { display: flex; justify-content: space-between; gap: 1rem; color: var(--text-muted); }
.final-score b { font-family: var(--font-display); font-size: 1.8rem; line-height: 1; }
.final-score .is-winner { color: var(--text); font-weight: 700; }
.final-score .is-winner b { color: var(--win); }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: max-content; min-width: min(340px, calc(100vw - 2rem)); max-width: calc(100vw - 2rem); padding: .8rem 1rem .8rem 1.2rem; border-radius: 14px;
  background: var(--navy-900); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); font-weight: 600;
}
.toast__action { background: none; border: 0; color: var(--sky-400); font: 700 1rem var(--font-body); cursor: pointer; padding: .35rem .5rem; text-transform: uppercase; letter-spacing: .04em; }

/* --- TV scoreboard ---------------------------------------------------------- */

.app-body.is-tv { background: #050d1a; color: #fff; overflow: hidden; }
.tv { position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; }
.tv.hide-cursor, .tv.hide-cursor * { cursor: none !important; }
.tv__screen { flex: 1; display: flex; flex-direction: column; padding: 2.2vh 2.2vw; gap: 2vh; min-height: 0; }
.tv__corner { position: fixed; right: 1.2vw; bottom: 1.2vh; display: flex; gap: .75rem; align-items: center; opacity: .5; }
.tv__corner:hover { opacity: 1; }
.tv__fs { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: .4rem .8rem; font: 600 .85rem var(--font-body); cursor: pointer; }
.tv__offline { display: none; color: #ffb3c0; font-weight: 700; font-size: .9rem; }
.tv.is-offline .tv__offline { display: inline; }
.tv__next { text-align: center; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .2em; color: #8fa7c6; font-size: 2.2vh; }
.tv__idle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; text-align: center; }
.tv__idle img { height: 22vh; }
.tv__idle-title { font-family: var(--font-display); text-transform: uppercase; font-size: 9vh; letter-spacing: .04em; font-weight: 700; }
.tv__idle-sub { font-size: 3vh; color: #9fb3cc; max-width: 70vw; }

.tvb {
  flex: 1; display: flex; flex-direction: column; min-height: 0; border-radius: 2vh; overflow: hidden;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(65,182,230,.18), transparent 60%), linear-gradient(180deg, #0f2747, #0a1c36);
  border: 1px solid rgba(255,255,255,.08);
}
.tvb__top { display: flex; align-items: center; gap: 2vw; padding: 1.6vh 2vw; background: rgba(0,0,0,.25); font-size: 2.6vh; }
.tvb__status { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .15em; color: #ff6b84; font-weight: 700; display: inline-flex; align-items: center; gap: .6vw; }
.tvb.is-final .tvb__status { color: var(--gold-500); }
.tvb__event { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: 3.2vh; font-weight: 600; }
.tvb__meta { color: #9fb3cc; flex: 1; }
/* Table & cups icons in the top bar */
.tvb__meta .setup { gap: .5vh 1.6vw; }
.tvb__meta .setup__item { gap: .6vw; }
.tvb__meta .setup-icon { width: 1.5em; height: 1.5em; }
.tvb__clock { font-family: var(--font-display); font-size: 3.4vh; font-variant-numeric: tabular-nums; color: #d4e3f5; }
.tvb__main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; min-height: 0; }
/* Team: photos + names beside the score, score toward the middle */
.tvb__team { display: flex; align-items: center; justify-content: flex-end; gap: 3vw; min-width: 0; }
.tvb__team--2 { justify-content: flex-start; }
.tvb__team--2 .tvb__score { order: -1; }
.tvb__id { display: flex; flex-direction: column; align-items: center; gap: 1.2vh; text-align: center; min-width: 0; }
.tvb__faces { display: flex; gap: 1vw; }
.tvb__faces .avatar--xl { width: 14vh; height: 14vh; font-size: 5vh; border-width: .5vh; }
.tvb__names { font-size: 3.4vh; font-weight: 700; color: #c4d5ea; max-width: 26vw; }
.tvb__score { font-family: var(--font-display); font-weight: 700; font-size: 36vh; line-height: .85; color: rgba(255,255,255,.45); font-variant-numeric: tabular-nums; min-width: 1ch; text-align: center; }
.tvb__team.is-leading .tvb__score, .tvb__team.is-leading .tvb__names { color: #fff; }
.tvb__team.is-winner .tvb__score { color: var(--gold-500); }
.tvb__flag { min-height: 4.4vh; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .15em; font-size: 3vh; font-weight: 700; color: var(--gold-500); }
/* Each side in its team color: a solid line on the outer edge and a soft tint
   behind the players and score that fades toward the middle */
.tvb__team--1 { --team: var(--sky-500); --team-rgb: 65, 182, 230; }
.tvb__team--2 { --team: var(--red-600); --team-rgb: 228, 0, 43; }
/* The two tints meet in the middle; the scores keep a gap between them from
   extra padding on each panel's middle side */
.tvb__team { --team-line: 1.1vh; --pad-y: 2vh; --edge: 3vw; --mid: calc(var(--edge) + (4vw + 5.5vh) / 2); }
.tvb__team--1 { padding: var(--pad-y) var(--mid) var(--pad-y) var(--edge); }
.tvb__team--2 { padding: var(--pad-y) var(--edge) var(--pad-y) var(--mid); }
.tvb__team--1 { background: linear-gradient(90deg, rgba(var(--team-rgb), .26), rgba(var(--team-rgb), .05)); box-shadow: inset var(--team-line) 0 0 var(--team); }
.tvb__team--2 { background: linear-gradient(270deg, rgba(var(--team-rgb), .34), rgba(var(--team-rgb), .07)); box-shadow: inset calc(-1 * var(--team-line)) 0 0 var(--team); }
.tvb__team .tvb__faces .avatar { box-shadow: 0 0 0 .5vh var(--team); }
.tvb__score.bump { animation: tv-bump .9s ease; }
@keyframes tv-bump {
  0% { transform: scale(1); }
  25% { transform: scale(1.18); color: #fff; text-shadow: 0 0 6vh rgba(var(--team-rgb), .8); }
  100% { transform: scale(1); }
}

/* Equal halves, so the split between stats and recent points lines up with the middle of the score area above */
.tvb__bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2vw; padding: 1.5vh 2vw 2vh; background: rgba(0,0,0,.2); }
.tvb__stats { width: 100%; border-collapse: collapse; font-size: 2.5vh; font-variant-numeric: tabular-nums; }
.tvb__stats th { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: 1.9vh; color: #8fa7c6; font-weight: 500; text-align: right; padding: .6vh .8vw; }
.tvb__stats td { padding: .7vh .8vw; text-align: right; border-top: 1px solid rgba(255,255,255,.08); }
.tvb__stats td:first-child { text-align: left; display: flex; align-items: center; gap: .8vw; font-weight: 600; }
.tvb__stats td:last-child { font-weight: 700; }
.tvb__stats .avatar--md { width: 4.4vh; height: 4.4vh; font-size: 1.6vh; }
.tvb__stats tr.team-1 td:first-child { box-shadow: inset .4vw 0 0 var(--sky-500); padding-left: 1vw; }
.tvb__stats tr.team-2 td:first-child { box-shadow: inset .4vw 0 0 var(--red-600); padding-left: 1vw; }
.tvb__recent-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: #8fa7c6; font-size: 1.9vh; margin-bottom: .6vh; }
.tvb__waiting { color: #8fa7c6; font-size: 2.6vh; margin: 1vh 0 0; }
.tvb__feed { list-style: none; margin: 0; padding: 0; }
.tvb__feed .pt { grid-template-columns: 7.6vh auto 1fr auto; padding: .7vh .8vw; gap: .9vw; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 2.4vh; }
.tvb__feed .pt__score { font-size: 2.8vh; }
.tvb__feed .pt__how { color: #9fb3cc; font-size: 2.1vh; }
.tvb__feed .pt__how.is-topper { color: var(--gold-500); }
.tvb__feed .pt__time { color: #6f819b; font-size: 2vh; }
.tvb__feed .avatar--md { width: 4.4vh; height: 4.4vh; font-size: 1.6vh; }
/* Each point in the scoring team's color: blue team's bar on the left, red
   team's on the right, with a soft tint fading out from the bar */
.tvb__feed .pt--1 { --pt-rgb: 65, 182, 230; box-shadow: inset .4vw 0 0 var(--sky-500); background-image: linear-gradient(90deg, rgba(var(--pt-rgb), .16), rgba(var(--pt-rgb), .03)); }
.tvb__feed .pt--2 { --pt-rgb: 228, 0, 43; box-shadow: inset -.4vw 0 0 var(--red-600); background-image: linear-gradient(270deg, rgba(var(--pt-rgb), .2), rgba(var(--pt-rgb), .04)); }
.tvb__feed .pt.is-fresh { animation: tv-fresh 3s ease; }
/* A new point flashes in its team's color, then settles back to the tint */
@keyframes tv-fresh { 0% { background-color: rgba(var(--pt-rgb), .45); } 100% { background-color: transparent; } }
/* Toppers: a pulsing gold Chicago star and a slow gold glow across the row
   (a brighter gold flash when it's the point that just came in). The glow is
   a layer behind the row whose opacity pulses: cheap to animate on a Fire TV. */
.tvb__feed .pt--topper { position: relative; isolation: isolate; }
.tvb__feed .pt--topper.is-fresh { animation: none; }
.tvb__feed .pt--topper::before {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: .4vw; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(242,176,30,.5), rgba(242,176,30,.2) 60%, rgba(242,176,30,.1));
  opacity: .12; animation: tv-topper 3.2s ease-in-out var(--phase, 0s) infinite;
}
.tvb__feed .pt--2.pt--topper::before { left: 0; right: .4vw; background: linear-gradient(270deg, rgba(242,176,30,.5), rgba(242,176,30,.2) 60%, rgba(242,176,30,.1)); }
.tvb__feed .pt--topper.is-fresh::before { animation: tv-topper-flash 1.6s ease-out, tv-topper 3.2s ease-in-out 1.6s infinite; }
.pt__star { display: inline-block; width: 1.3em; height: 1.3em; margin-right: .35em; vertical-align: -.25em; color: var(--gold-500); filter: drop-shadow(0 0 .5vh rgba(242,176,30,.75)); animation: tv-star 1.6s ease-in-out var(--phase, 0s) infinite; }
@keyframes tv-topper { 0%, 100% { opacity: .12; } 50% { opacity: 1; } }
@keyframes tv-topper-flash { 0%, 25% { opacity: 1; } 100% { opacity: .12; } }
@keyframes tv-star { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.3); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .tvb__feed .pt--topper::before { animation: none; opacity: .6; }
  .pt__star { animation: none; }
}

/* Several games at once: the others along the bottom, with a bar that fills
   until the screen switches to the next game */
.tv-also {
  position: relative; display: flex; align-items: center; gap: 1.6vw; padding: 1.2vh 1.6vw; overflow: hidden;
  border-radius: 1.4vh; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); font-size: 2.4vh;
}
.tv-also__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .14em; font-size: 1.9vh; color: #8fa7c6; white-space: nowrap; }
.tv-also__games { display: flex; flex-wrap: wrap; gap: 1vh 3vw; min-width: 0; }
.tv-also__game { display: inline-flex; align-items: center; gap: .8vw; white-space: nowrap; font-weight: 600; color: #d4e3f5; }
.tv-also__score { font-family: var(--font-display); font-size: 3vh; font-weight: 700; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.45); }
.tv-also__s1 { color: var(--sky-500); }
.tv-also__s2 { color: #ff4d6a; }
.tv-also__final { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .12em; font-size: 1.8vh; color: var(--gold-500); }
.tv-also__timer {
  position: absolute; left: 0; right: 0; bottom: 0; height: .45vh; background: rgba(255,255,255,.3); transform-origin: left center;
  animation: tv-rotate var(--rotate, 15s) linear var(--elapsed, 0s) forwards;
}
@keyframes tv-rotate { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* The strip takes some height, so the score area steps down a little to fit */
@media (min-aspect-ratio: 4/3) {
  .tv__screen--also .tvb__score { font-size: 30vh; }
  .tv__screen--also .tvb__faces .avatar--xl { width: 12vh; height: 12vh; }
  .tv__screen--also .tvb__team { --pad-y: 1.5vh; }
}

@media (max-aspect-ratio: 4/3) {
  /* Portrait tablets/phones used as a scoreboard: teams stacked with both scores
     on the right; the score area keeps its size and the stats / recent points
     below get what's left */
  .tvb__main { flex: none; grid-template-columns: 1fr; }
  .tvb__top { flex-wrap: wrap; row-gap: .4vh; }
  .tvb__meta { order: 1; flex-basis: 100%; font-size: 1.9vh; }
  .tvb__clock { margin-left: auto; }
  .tvb__team, .tvb__team--2 { justify-content: space-between; --pad-y: 1.2vh; --edge: 6vw; --mid: var(--edge); }
  .tvb__team--2 .tvb__score { order: 0; }
  .tvb__faces .avatar--xl { width: 9vh; height: 9vh; font-size: 3.2vh; }
  .tvb__names { font-size: 2.6vh; max-width: 50vw; }
  .tvb__flag { min-height: 0; font-size: 2.2vh; }
  .tvb__score { font-size: 13vh; }
  .tvb__bottom { flex: 1; min-height: 0; overflow: hidden; grid-template-columns: 1fr; align-content: start; }
  .tvb__feed .pt:nth-child(n+3) { display: none; }
  .tvb__stats { font-size: 2vh; }
  .tvb__stats th { font-size: 1.5vh; padding: .3vh .8vw; }
  .tvb__stats td { padding: .45vh .8vw; }
  .tvb__stats .avatar--md, .tvb__feed .avatar--md { width: 3.4vh; height: 3.4vh; }
  .tvb__stats .rbar-wrap { margin-top: .3vh; }
  .tvb__stats .rbar__icon { width: 2vh; height: 2vh; }
  .tvb__feed .pt { font-size: 2vh; padding: .5vh .8vw; }
  .tvb__feed .pt__how { font-size: 1.7vh; }
  /* With other games listed at the bottom there's no room for recent points */
  .tv__screen--also .tvb__recent { display: none; }
  .tv-also { flex-wrap: wrap; gap: .4vh 1.6vw; padding: .8vh 1.6vw; font-size: 1.8vh; }
  .tv-also__label { font-size: 1.4vh; }
  .tv-also__score { font-size: 2.3vh; }
  .tv-also__game { white-space: normal; flex-wrap: wrap; row-gap: .2vh; }
}
@media (max-aspect-ratio: 3/5) {
  /* Phones: no room for recent points under the stats */
  .tvb__recent { display: none; }
}

/* Sheets on small phones: let long titles and buttons wrap, keep tables compact */
.sheet .btn { white-space: normal; text-align: center; line-height: 1.2; }
.sheet .btn small { display: inline-block; }
.sheet__title { overflow-wrap: anywhere; }
.sheet .stats-table { font-size: .92rem; }
.sheet .stats-table th, .sheet .stats-table td { padding: .5rem .45rem; }
.sheet .stats-table td.col-left { white-space: nowrap; }
.sheet .stats-table td.col-left .avatar { vertical-align: middle; margin-right: .3rem; }

/* Small headshots of the player(s) who dropped it */
.pt__faces { display: inline-flex; margin-right: .4rem; vertical-align: middle; }
.pt__faces .avatar { width: 22px; height: 22px; font-size: .55rem; border-width: 1px; }
.pt__faces .avatar + .avatar { margin-left: -6px; }
.tvb__feed .pt__faces .avatar { width: 3.2vh; height: 3.2vh; font-size: 1.2vh; }
.tvb__feed .pt__faces .avatar + .avatar { margin-left: -.8vh; }
/* The corner controls fade away with the pointer so they never cover the board */
.tv__corner { transition: opacity .3s; }
.tv.hide-cursor .tv__corner { opacity: 0; pointer-events: none; }
.tv__fs { font-size: .75rem; padding: .3rem .6rem; }
@media (max-width: 420px) {
  .sheet .stats-table { font-size: .85rem; }
  .sheet .stats-table th { font-size: .72rem; letter-spacing: .03em; }
  .sheet .stats-table th, .sheet .stats-table td { padding: .45rem .3rem; }
  .sheet .stats-table td.col-left .avatar { display: none; }
}

/* TV: rating bar under each player's rating (0 to 158.3, red to green) */
.tvb__stats td.tvb__rating { min-width: 10vw; vertical-align: middle; }
.rbar-wrap { display: flex; align-items: center; gap: .5vw; margin-top: .6vh; }
.rbar { display: block; flex: 1; height: .9vh; min-height: 5px; border-radius: 1vh; background: rgba(255,255,255,.12); overflow: hidden; }
/* Icon spot: a green star for a perfect 158.3, a red badge for a 0 (empty otherwise, so bars line up) */
.rbar__icon { flex: none; width: 2.8vh; height: 2.8vh; min-width: 16px; min-height: 16px; display: grid; place-items: center; }
.rbar__icon svg { width: 100%; height: 100%; display: block; }
.rbar-wrap.is-perfect .rbar__icon { color: hsl(120 75% 50%); }
.rbar-wrap.is-zero .rbar__icon { color: hsl(0 80% 55%); }
.rbar__fill {
  display: block; height: 100%; border-radius: inherit; background: hsl(var(--meter-hue, 0) 75% 50%);
  transition: width .9s cubic-bezier(.2,.8,.2,1), background-color .9s ease;
}
.rbar-wrap.is-perfect .rbar__fill { box-shadow: 0 0 1.2vh hsla(120, 75%, 50%, .8); }
