:root {
  color: #080806;
  background: #eef2e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { display: grid; min-height: 100vh; grid-template-rows: auto 1fr auto; margin: 0; overflow-x: hidden; background: #eef2e8; }
body::before {
  position: fixed;
  z-index: 0;
  right: 2vw;
  bottom: -7vh;
  width: min(48vw, 720px);
  aspect-ratio: 1;
  background: url("../assets/logo.png") center / contain no-repeat;
  content: "";
  opacity: .055;
  pointer-events: none;
  animation: tv-logo-float 22s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  position: fixed;
  inset: -22vmax;
  z-index: 0;
  background:
    radial-gradient(circle at 22% 72%, rgba(245,180,0,.17) 0 9%, rgba(245,180,0,.07) 18%, transparent 34%),
    radial-gradient(circle at 76% 24%, rgba(255,255,255,.92) 0 8%, rgba(255,255,255,.34) 20%, transparent 36%),
    linear-gradient(115deg, transparent 34%, rgba(245,180,0,.045) 49%, transparent 64%);
  content: "";
  pointer-events: none;
  animation: tv-ambient-drift 26s ease-in-out infinite alternate;
  will-change: transform;
}

.tv-header,
.tv-main,
.tv-footer { position: relative; z-index: 1; }

.tv-header {
  display: flex;
  min-height: 108px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 14px 3vw;
  border-top: 5px solid #11110d;
  border-bottom: 1px solid rgba(8,8,6,.12);
  color: #080806;
  background: #fff;
}

.tv-brand { display: flex; align-items: center; gap: 18px; }
.tv-brand img { width: 72px; height: 72px; object-fit: contain; }
.tv-brand div { display: grid; gap: 3px; }
.tv-brand span { color: rgba(8,8,6,.64); font-size: clamp(.86rem, 1vw, 1.1rem); font-weight: 650; text-transform: uppercase; }
.tv-brand strong { color: #080806; font-size: clamp(1.35rem, 1.9vw, 2.1rem); font-weight: 650; letter-spacing: 0; }
.tv-brand small { color: rgba(8,8,6,.5); font-size: clamp(.68rem, .75vw, .82rem); font-weight: 500; text-transform: uppercase; }
.tv-clock { display: grid; justify-items: end; gap: 2px; }
.tv-clock span { color: rgba(8,8,6,.64); font-size: clamp(.86rem, 1vw, 1.05rem); font-weight: 500; }
.tv-clock strong { color: #080806; font-size: clamp(2.3rem, 4vw, 4.4rem); font-weight: 600; line-height: .9; font-variant-numeric: tabular-nums; }

.tv-main { display: grid; min-width: 0; grid-template-rows: minmax(0,1fr) auto; gap: 2vh; padding: 3vh 3vw 2.2vh; }
.tv-screen-stage { display: grid; min-width: 0; }
.tv-screen { grid-area: 1 / 1; min-width: 0; align-self: start; opacity: 0; pointer-events: none; transform: translateY(12px) scale(.995); transition: opacity 900ms ease, transform 900ms ease, visibility 0s linear 900ms; visibility: hidden; }
.tv-screen.is-active { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); transition-delay: 0s; visibility: visible; }
.tv-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 2vh; }
.tv-kicker { color: rgba(8,8,6,.64); font-size: clamp(.76rem, .9vw, .95rem); font-weight: 650; text-transform: uppercase; }
.tv-heading h1 { margin: 6px 0 0; color: #080806; font-size: clamp(2rem, 3.2vw, 3.7rem); font-weight: 600; line-height: 1; letter-spacing: 0; }
.tv-heading h1::after { display: block; width: 72px; height: 4px; margin-top: 13px; background: #11110d; content: ""; }
.tv-heading button { min-height: 42px; padding: 0 18px; border: 1px solid rgba(8,8,6,.18); border-radius: 5px; color: #080806; background: #fff; font-weight: 600; cursor: pointer; }
.tv-heading button:hover { border-color: #080806; background: #ecefe4; }
.tv-heading button[hidden] { display: none; }

.tv-sponsor-heading { align-items: end; }
.tv-sponsor-heading > p { max-width: 470px; margin: 0; color: rgba(8,8,6,.6); font-size: clamp(.92rem,1.1vw,1.18rem); line-height: 1.5; text-align: right; }
.tv-sponsor-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: clamp(12px,1.2vw,20px); }
.tv-sponsor-card { position: relative; display: grid; min-height: clamp(145px,18vh,210px); grid-column: span 2; place-items: center; padding: clamp(22px,2.2vw,38px); overflow: hidden; border: 1px solid rgba(8,8,6,.12); border-radius: 9px; background: rgba(255,255,255,.94); box-shadow: 0 16px 42px rgba(8,8,6,.075); }
.tv-sponsor-card::after { position: absolute; inset: auto 0 0; height: 4px; background: linear-gradient(90deg,#11110d 0 24%,#f5b400 24% 100%); content: ""; }
.tv-sponsor-card.is-main { min-height: clamp(180px,23vh,265px); grid-column: span 3; }
.tv-sponsor-card span { position: absolute; top: 14px; left: 16px; color: rgba(8,8,6,.52); font-size: clamp(.6rem,.68vw,.76rem); font-weight: 650; text-transform: uppercase; }
.tv-sponsor-card img { width: 100%; max-width: 300px; height: clamp(68px,9vh,112px); object-fit: contain; }
.tv-sponsor-card.is-main img { max-width: 410px; height: clamp(88px,13vh,150px); }
.tv-sponsor-card img[alt*="ixtrac" i] { width: 82%; max-width: 250px; height: clamp(62px,8vh,96px); object-fit: cover; transform: none; }
.tv-sponsor-card strong { font-size: clamp(1.25rem,2vw,2.2rem); text-align: center; }
.tv-sponsor-loading { display: grid; min-height: 44vh; grid-column: 1/-1; place-items: center; border: 1px solid rgba(8,8,6,.12); border-radius: 9px; color: rgba(8,8,6,.58); background: rgba(255,255,255,.88); font-size: clamp(1rem,1.4vw,1.5rem); }

.tv-matches-heading { align-items: end; }
.tv-matches-heading > p { max-width: 540px; margin: 0; color: rgba(8,8,6,.6); font-size: clamp(.92rem,1.05vw,1.14rem); line-height: 1.5; text-align: right; }
.tv-first-team-overview { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(320px,.75fr); gap: clamp(16px,1.5vw,26px); }
.tv-first-team-matches { display: grid; align-content: start; gap: clamp(16px,1.5vw,26px); }
.tv-ranking-panel { overflow: hidden; border: 1px solid rgba(8,8,6,.13); border-radius: 9px; background: rgba(255,255,255,.94); box-shadow: 0 16px 42px rgba(8,8,6,.075); }
.tv-ranking-shell { overflow: hidden; }
.tv-ranking-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tv-ranking-table th, .tv-ranking-table td { padding: clamp(7px,.75vh,11px) clamp(10px,.8vw,16px); border-bottom: 1px solid rgba(8,8,6,.09); text-align: center; font-size: clamp(.74rem,.82vw,.96rem); font-variant-numeric: tabular-nums; }
.tv-ranking-table th { color: rgba(8,8,6,.56); background: rgba(238,242,232,.62); font-size: clamp(.62rem,.66vw,.74rem); font-weight: 650; text-transform: uppercase; }
.tv-ranking-table th:nth-child(2), .tv-ranking-table td:nth-child(2) { width: 52%; text-align: left; }
.tv-ranking-table th:first-child, .tv-ranking-table td:first-child { width: 9%; }
.tv-ranking-table th:nth-child(3), .tv-ranking-table td:nth-child(3) { width: 11%; }
.tv-ranking-table th:nth-child(4), .tv-ranking-table td:nth-child(4) { width: 17%; }
.tv-ranking-table th:last-child, .tv-ranking-table td:last-child { width: 11%; font-weight: 650; }
.tv-ranking-table tbody tr:last-child td { border-bottom: 0; }
.tv-ranking-table tbody tr:nth-child(even) { background: rgba(238,242,232,.38); }
.tv-ranking-table tbody tr.is-phoenix { color: #080806; background: rgba(245,180,0,.19); font-weight: 700; box-shadow: inset 4px 0 0 #f5b400; }
.tv-ranking-loading { height: 46vh; color: rgba(8,8,6,.58); text-align: center !important; }
.tv-match-panel { overflow: hidden; border: 1px solid rgba(8,8,6,.13); border-radius: 9px; background: rgba(255,255,255,.94); box-shadow: 0 16px 42px rgba(8,8,6,.075); }
.tv-match-panel-heading { display: flex; min-height: 76px; align-items: end; justify-content: space-between; gap: 18px; padding: 16px clamp(18px,1.6vw,28px); border-bottom: 1px solid rgba(8,8,6,.1); background: linear-gradient(135deg,#fff,rgba(238,242,232,.86)); }
.tv-match-panel-heading span { color: rgba(8,8,6,.52); font-size: clamp(.65rem,.7vw,.78rem); font-weight: 650; text-transform: uppercase; }
.tv-match-panel-heading h2 { margin: 0; color: #080806; font-size: clamp(1.25rem,1.7vw,1.9rem); font-weight: 600; }
.tv-match-panel.is-upcoming .tv-match-panel-heading { background: linear-gradient(135deg,rgba(245,180,0,.16),#fff 72%); }
.tv-match-list { display: grid; }
.tv-match-card { display: grid; min-height: clamp(126px,15vh,170px); grid-template-columns: minmax(100px,.34fr) minmax(0,1fr); align-items: center; gap: clamp(14px,1.4vw,24px); padding: clamp(16px,2vh,24px) clamp(18px,1.6vw,28px); border-bottom: 1px solid rgba(8,8,6,.1); }
.tv-match-card:last-child { border-bottom: 0; }
.tv-match-card:nth-child(even) { background: rgba(238,242,232,.48); }
.tv-match-meta { display: grid; gap: 5px; }
.tv-match-meta strong { color: #080806; font-size: clamp(.88rem,1vw,1.08rem); font-weight: 650; text-transform: uppercase; }
.tv-match-meta span { color: rgba(8,8,6,.55); font-size: clamp(.68rem,.72vw,.8rem); line-height: 1.35; }
.tv-match-teams { display: grid; gap: 7px; }
.tv-match-teams > div { display: grid; min-width: 0; grid-template-columns: minmax(0,1fr) 34px; align-items: center; gap: 12px; color: rgba(8,8,6,.68); font-size: clamp(.88rem,1.03vw,1.16rem); }
.tv-match-teams > div.is-phoenix { color: #080806; font-weight: 650; }
.tv-match-teams span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-match-teams strong { display: grid; width: 32px; height: 28px; place-items: center; border-radius: 4px; color: #080806; background: #ecefe4; font-size: clamp(.9rem,1vw,1.12rem); font-weight: 650; font-variant-numeric: tabular-nums; }
.tv-match-panel.is-upcoming .tv-match-teams strong { color: rgba(8,8,6,.42); background: rgba(245,180,0,.15); }
.tv-match-loading { display: grid; min-height: 35vh; place-items: center; padding: 30px; color: rgba(8,8,6,.58); text-align: center; }

.tv-rotation-progress { height: 3px; overflow: hidden; border-radius: 999px; background: rgba(8,8,6,.08); }
.tv-rotation-progress i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg,#11110d,#f5b400); transform: scaleX(0); transform-origin: left; }
.tv-rotation-progress i.is-running { animation: tv-progress-fill var(--tv-screen-duration,20000ms) linear forwards; }

.tv-table-shell { overflow: hidden; border: 1px solid rgba(8,8,6,.14); border-radius: 7px; background: rgba(255,255,255,.94); box-shadow: 0 18px 48px rgba(8,8,6,.09); }
.tv-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tv-table th, .tv-table td { padding: clamp(13px, 1.8vh, 23px) clamp(12px, 1.35vw, 24px); border-bottom: 1px solid rgba(8,8,6,.1); text-align: left; vertical-align: middle; overflow-wrap: break-word; }
.tv-table th { color: #fff; background: #11110d; font-size: clamp(.7rem, .82vw, .9rem); font-weight: 550; text-transform: uppercase; }
.tv-table td { color: #080806; font-size: clamp(1rem, 1.35vw, 1.55rem); font-weight: 450; }
.tv-table tbody tr:last-child td { border-bottom: 0; }
.tv-table tbody tr:nth-child(even) { background: rgba(238,242,232,.72); }
.tv-table th:first-child, .tv-table td:first-child { width: 17%; }
.tv-table th:nth-child(2), .tv-table td:nth-child(2) { width: 14%; }
.tv-table th:nth-child(3), .tv-table td:nth-child(3) { width: 32%; }
.tv-table th:nth-child(4), .tv-table td:nth-child(4) { width: 18%; }
.tv-table th:last-child, .tv-table td:last-child { width: 19%; }
.tv-time-value { color: #080806 !important; font-size: clamp(1.15rem, 1.7vw, 1.9rem) !important; font-weight: 600 !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tv-pitch { color: #080806 !important; background: #eef2e8; font-weight: 600 !important; box-shadow: inset 1px 0 0 rgba(8,8,6,.14); }
.tv-type { display: inline-block; padding: 6px 9px; border: 1px solid rgba(8,8,6,.12); border-radius: 4px; color: #080806; background: #ecefe4; font-size: .72em; font-weight: 550; }
.tv-team.is-home { font-weight: 650; }
.tv-team.is-guest { color: rgba(8,8,6,.64); font-weight: 450; }
.tv-guest-label { display: inline-block; margin-left: 12px; padding: 4px 7px; border: 1px solid rgba(8,8,6,.14); border-radius: 4px; color: rgba(8,8,6,.64); background: #ecefe4; font-size: .55em; font-weight: 650; text-transform: uppercase; vertical-align: middle; }
.tv-table tbody tr.is-guest { background: #fafaf7; }
.tv-loading, .tv-empty { height: 30vh; color: rgba(8,8,6,.64); text-align: center !important; }

.tv-footer { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 3vw; border-top: 1px solid rgba(8,8,6,.12); color: rgba(8,8,6,.64); background: #fff; font-size: clamp(.76rem, .86vw, .95rem); }
.tv-footer span { display: flex; align-items: center; gap: 9px; }
.tv-footer i { width: 9px; height: 9px; border-radius: 50%; background: #11110d; box-shadow: 0 0 0 4px rgba(8,8,6,.09); animation: tv-status-pulse 3.2s ease-in-out infinite; }
.tv-view-indicator { display: flex; align-items: center; justify-content: center; gap: 7px; }
.tv-view-indicator button { display: grid; width: 26px; height: 26px; place-items: center; padding: 0; border: 0; border-radius: 999px; background: transparent; cursor: pointer; transition: width 600ms ease; }
.tv-view-indicator button::before { width: 8px; height: 8px; border-radius: 50%; background: rgba(8,8,6,.2); content: ""; transition: width 600ms ease, border-radius 600ms ease, background 600ms ease, transform 220ms ease; }
.tv-view-indicator button:hover::before, .tv-view-indicator button:focus-visible::before { background: rgba(8,8,6,.52); transform: scale(1.18); }
.tv-view-indicator button:focus-visible { outline: 2px solid #f5b400; outline-offset: 3px; }
.tv-view-indicator button.is-active { width: 38px; }
.tv-view-indicator button.is-active::before { width: 24px; border-radius: 999px; background: #f5b400; }
.tv-view-indicator small { min-width: 118px; margin-left: 5px; color: rgba(8,8,6,.55); font-size: .72rem; font-weight: 600; }

@keyframes tv-progress-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes tv-ambient-drift {
  0% { transform: translate3d(-2.5vw,-1.5vh,0) rotate(-1deg) scale(1); }
  50% { transform: translate3d(2vw,1vh,0) rotate(.6deg) scale(1.025); }
  100% { transform: translate3d(4vw,2.5vh,0) rotate(1.2deg) scale(1.045); }
}

@keyframes tv-logo-float {
  0% { transform: translate3d(0,0,0) rotate(-2deg); }
  100% { transform: translate3d(-1.8vw,-2.2vh,0) rotate(1.5deg); }
}

@keyframes tv-status-pulse {
  0%, 100% { opacity: .72; box-shadow: 0 0 0 4px rgba(8,8,6,.08); }
  50% { opacity: 1; box-shadow: 0 0 0 8px rgba(245,180,0,.16); }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .tv-footer i,
  .tv-rotation-progress i.is-running { animation: none; }

  .tv-screen { transition: none; }
}

@media (max-width: 900px) {
  body::before { right: -12vw; bottom: 3vh; width: 78vw; opacity: .04; }
  .tv-header { min-height: 90px; }
  .tv-brand img { width: 58px; height: 58px; }
  .tv-table-shell { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .tv-table, .tv-table tbody { display: block; width: 100%; }
  .tv-table thead { display: none; }
  .tv-table tbody { display: grid; gap: 12px; }
  .tv-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: hidden; border: 1px solid rgba(8,8,6,.12); border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(8,8,6,.06); }
  .tv-table tbody td { display: grid; width: auto !important; gap: 5px; padding: 13px 15px; font-size: 1rem; }
  .tv-table tbody td::before { color: rgba(8,8,6,.64); content: attr(data-label); font-size: .65rem; font-weight: 650; text-transform: uppercase; }
  .tv-table .tv-empty, .tv-table .tv-loading { display: block; grid-column: 1/-1; width: 100% !important; }
  .tv-table .tv-empty::before, .tv-table .tv-loading::before { content: none; }
  .tv-sponsor-heading { align-items: flex-start; flex-direction: column; }
  .tv-sponsor-heading > p { text-align: left; }
  .tv-matches-heading { align-items: flex-start; flex-direction: column; }
  .tv-matches-heading > p { text-align: left; }
  .tv-first-team-overview { grid-template-columns: 1fr; }
  .tv-first-team-matches { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tv-match-card { min-height: 82px; }
  .tv-sponsor-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tv-sponsor-card, .tv-sponsor-card.is-main { min-height: 150px; grid-column: span 1; }
}

@media (max-width: 560px) {
  .tv-header, .tv-heading, .tv-footer { align-items: flex-start; flex-direction: column; }
  .tv-clock { justify-items: start; }
  .tv-table tbody tr { grid-template-columns: 1fr; }
  .tv-sponsor-grid { grid-template-columns: 1fr; }
  .tv-match-card { grid-template-columns: 1fr; }
  .tv-footer { width: 100%; }
}

@media (max-height: 700px) {
  .tv-header { min-height: 82px; padding-top: 8px; padding-bottom: 8px; }
  .tv-brand img { width: 58px; height: 58px; }
  .tv-main { padding-top: 14px; padding-bottom: 14px; }
  .tv-heading { margin-bottom: 12px; }
  .tv-table th, .tv-table td { padding-top: 11px; padding-bottom: 11px; }
  .tv-match-card:nth-child(n+4) { display: none; }
  .tv-match-card { min-height: 78px; padding-top: 10px; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
