:root {
  color-scheme: dark;
  --tv-bg: #091424;
  --tv-panel: #101f34;
  --tv-line: #30415a;
  --tv-text: #f6f8fc;
  --tv-muted: #b4c2d8;
  --tv-blue: #85bdff;
  --tv-red: #ff958e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--tv-bg);
  color: var(--tv-text);
  font-family: Manrope, system-ui, sans-serif;
}
.tv-shell {
  width: min(100% - 2 * clamp(1rem, 4vw, 5.25rem), 1780px);
  min-height: 100vh;
  margin-inline: auto;
  padding-block: clamp(1rem, 4vh, 3rem) clamp(1rem, 3vh, 2.5rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 1.25rem;
}
.tv-header {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 3fr) minmax(150px, 1fr);
  align-items: center;
  gap: clamp(.75rem, 2vw, 2rem);
}
.tv-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  font-size: clamp(.75rem, 1.1vw, 1.125rem);
  font-weight: 800;
  line-height: 1.2;
}
.tv-brand img {
  flex: none;
  width: clamp(36px, 3.25vw, 64px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
}
.tv-header h1 {
  min-width: 0;
  margin: 0;
  font-size: clamp(1.15rem, 2.3vw, 2.9rem);
  line-height: 1.16;
  text-align: center;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.tv-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .5rem;
}
.tv-actions :is(a, button) {
  align-content: center;
  min-height: 40px;
  padding: .5rem .8rem;
  border: 1px solid var(--tv-line);
  border-radius: 6px;
  background: var(--tv-panel);
  color: var(--tv-text);
  text-decoration: none;
  font: 700 .85rem/1.15 Manrope, system-ui, sans-serif;
  cursor: pointer;
}
.tv-actions :is(a, button):hover { background: #233751; }
.tv-actions :is(a, button):focus-visible { outline: 2px solid var(--tv-blue); outline-offset: 3px; }

#tv-scoreboard {
  align-self: center;
  min-width: 0;
  width: 100%;
  padding-block: clamp(.25rem, 2vh, 2rem);
}
.tv-board {
  overflow: hidden;
  background: var(--tv-panel);
  border: 1px solid var(--tv-line);
  border-radius: 12px;
}
.tv-matchbar {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) 2fr minmax(max-content, 1fr);
  align-items: center;
  gap: clamp(.65rem, 1.6vw, 1.75rem);
  padding: clamp(.75rem, 1.5vw, 1.625rem) clamp(.875rem, 2.3vw, 2.5rem);
}
.tv-table {
  justify-self: start;
  font-size: clamp(.75rem, 1.4vw, 1.5rem);
  font-weight: 800;
}
.tv-table strong {
  margin-left: .2em;
  font-size: 1.35em;
  font-variant-numeric: tabular-nums;
}
.tv-matchinfo {
  min-width: 0;
  text-align: center;
  color: var(--tv-muted);
  font-size: clamp(.75rem, 1.2vw, 1.3rem);
  overflow-wrap: anywhere;
}
.tv-matchinfo strong {
  display: block;
  color: var(--tv-text);
  font-size: 1.27em;
  font-weight: 800;
}
.tv-status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: .55em;
  color: var(--tv-muted);
  font-size: clamp(.72rem, 1.15vw, 1.2rem);
  font-weight: 800;
}
.tv-status--live { color: #fff2f0; }
.tv-status--live::before {
  content: "";
  width: .55em;
  height: .55em;
  border-radius: 50%;
  background: #fa6966;
}
.tv-score {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tv-side {
  --tv-side-color: var(--tv-blue);
  min-width: 0;
  min-height: clamp(195px, 42vh, 490px);
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  justify-items: center;
  gap: clamp(.5rem, 2vh, 1.5rem);
  padding: clamp(1rem, 2.7vw, 3.5rem);
  text-align: center;
  border-top: 5px solid #519aff;
  background: linear-gradient(155deg, #173c6d, #112d51 72%);
}
.tv-side--2 {
  --tv-side-color: var(--tv-red);
  border-top-color: #ee6b67;
  border-left: 1px solid rgba(246, 248, 252, .12);
  background: linear-gradient(205deg, #66313e, #49232f 72%);
}
.tv-player { min-width: 0; overflow-wrap: anywhere; }
.tv-name {
  color: var(--tv-text);
  font-size: clamp(1.05rem, 3.25vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.tv-club {
  margin-top: .35em;
  color: var(--tv-side-color);
  font-size: clamp(.75rem, 1.35vw, 1.5rem);
  font-weight: 700;
}
.tv-winner {
  display: inline-block;
  margin-bottom: .35em;
  color: var(--tv-side-color);
  font-size: clamp(.72rem, 1.15vw, 1.2rem);
  font-weight: 800;
}
.tv-result {
  font-size: clamp(3.5rem, min(13vw, 25vh), 17rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: .91;
}
.tv-breakdown {
  display: flex;
  align-items: center;
  padding: clamp(.65rem, 1.55vw, 1.75rem) clamp(.875rem, 2.3vw, 2.5rem);
  gap: clamp(.65rem, 2.3vw, 2.5rem);
}
.tv-breakdown-title {
  color: var(--tv-muted);
  white-space: nowrap;
  font-size: clamp(.75rem, 1.2vw, 1.3rem);
  font-weight: 800;
}
.tv-sets {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tv-set {
  min-width: clamp(54px, 7.2vw, 122px);
  padding: .35em .55em;
  border: 1px solid var(--tv-line);
  border-radius: 6px;
  background: #14253d;
  text-align: center;
  font-size: clamp(1rem, 1.9vw, 2.3rem);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.05;
}
.tv-set small {
  display: block;
  margin-bottom: .45em;
  color: var(--tv-muted);
  font-size: .56em;
  font-weight: 800;
}
.tv-point--1 { color: var(--tv-blue); }
.tv-point--2 { color: var(--tv-red); }
.tv-next {
  display: grid;
  grid-template-columns: max-content 1fr auto;
  align-items: baseline;
  gap: .4rem clamp(.75rem, 2vw, 1.6rem);
  margin-top: 1rem;
  padding: clamp(.75rem, 1.6vw, 1.45rem) clamp(.875rem, 2.3vw, 2.5rem);
  border: 1px solid var(--tv-line);
  border-radius: 8px;
  font-size: clamp(.8rem, 1.4vw, 1.5rem);
  overflow-wrap: anywhere;
}
.tv-next :is(span, time) { color: var(--tv-muted); }
.tv-next time { white-space: nowrap; }
.tv-empty {
  display: grid;
  min-height: 12rem;
  place-items: center;
  padding: 1.5rem;
  border-top: 1px solid var(--tv-line);
  color: var(--tv-muted);
  font-size: clamp(1rem, 2vw, 2.4rem);
  text-align: center;
}
.tv-update {
  margin-top: .85rem;
  text-align: right;
  color: var(--tv-muted);
  font-size: clamp(.72rem, .9vw, 1rem);
  font-variant-numeric: tabular-nums;
}
.tv-connection {
  margin: 0;
  padding: .65rem 1rem;
  border: 1px solid #bf7859;
  border-radius: 6px;
  color: #ffd8c3;
}
@media (max-width: 680px) {
  .tv-shell { row-gap: 1.5rem; }
  .tv-header { grid-template-columns: 1fr auto; }
  .tv-header h1 { grid-row: 2; grid-column: 1 / -1; text-align: left; }
  #tv-scoreboard { align-self: start; }
  .tv-matchbar { grid-template-columns: 1fr auto; }
  .tv-matchinfo { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .tv-side { min-height: 175px; padding-inline: .65rem; }
  .tv-breakdown { align-items: flex-start; flex-direction: column; }
  .tv-next { grid-template-columns: 1fr auto; }
  .tv-next strong { grid-row: 2; grid-column: 1 / -1; }
}

.tv-shell--overview { grid-template-rows: auto auto 1fr; }
#tv-scoreboard.tv-overview { align-self: start; }
.tv-overview-heading, .tv-card-header, .tv-card-context {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.tv-overview-heading { flex-wrap: wrap; margin-bottom: 1rem; }
.tv-overview h2 { margin: 0; font-size: clamp(1.2rem, 2vw, 2.2rem); line-height: 1.18; }
.tv-overview-heading > span { color: var(--tv-muted); font-size: clamp(.85rem, 1.25vw, 1.4rem); }
.tv-table-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 315px), 1fr));
  gap: 1rem;
}
.tv-table-card {
  position: relative; overflow: hidden; min-width: 0; border: 1px solid var(--tv-line);
  border-radius: 9px; background: var(--tv-panel);
}
.tv-table-card:focus-within { outline: 2px solid var(--tv-blue); outline-offset: 3px; }
.tv-card-header, .tv-card-context { padding: .75rem 1rem; }
.tv-card-link { color: var(--tv-text); text-decoration: none; font-size: clamp(1rem, 1.35vw, 1.45rem); font-weight: 800; }
.tv-card-link span { margin-left: .2em; color: var(--tv-muted); }
.tv-card-link::after { position: absolute; inset: 0; content: ""; }
.tv-table-card:has(a:hover) { border-color: var(--tv-blue); }
.tv-card-header .tv-status { font-size: clamp(.7rem, .9vw, 1rem); }
.tv-card-players { font-size: clamp(1rem, 1.5vw, 1.7rem); }
.tv-card-player {
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  min-height: 58px; padding: .4rem 1rem; border-left: 4px solid #6eaeff; background: #17365d;
  font-weight: 800; overflow-wrap: anywhere;
}
.tv-card-player + .tv-card-player { border-left-color: #ee7b75; background: #532d38; }
.tv-card-player strong { font-size: 1.3em; font-variant-numeric: tabular-nums; }
.tv-card-context { color: var(--tv-muted); font-size: clamp(.72rem, .9vw, 1rem); }
.tv-card-context time { white-space: nowrap; }
.tv-schedule { margin-top: 1.5rem; }
.tv-schedule ul { margin: .65rem 0 0; padding: 0; list-style: none; border: 1px solid var(--tv-line); border-radius: 8px; }
.tv-schedule li {
  display: grid; grid-template-columns: clamp(5rem, 12vw, 8.5rem) 1fr auto; gap: .6rem;
  align-items: baseline; padding: .65rem .9rem; overflow-wrap: anywhere;
}
.tv-schedule li + li { border-top: 1px solid var(--tv-line); }
.tv-schedule span { color: var(--tv-muted); }
.tv-schedule a { color: var(--tv-blue); white-space: nowrap; }
@media (max-width: 470px) {
  .tv-schedule li { grid-template-columns: 1fr auto; font-size: .88rem; }
  .tv-schedule strong { grid-row: 2; grid-column: 1 / -1; }
}

.tv-live-number { display: grid; justify-items: center; gap: .5rem; }
.tv-set-total { color: var(--tv-side-color); font-size: clamp(.75rem, 1.3vw, 1.4rem); font-weight: 800; }
.tv-card-player small { color: var(--tv-muted); font-size: .55em; margin-right: .5em; }
.tv-card-player strong { white-space: nowrap; }
