/* =========================================================

   LIVE VIEW - CLEAN LANDSCAPE SCOREBOARD

========================================================= */



*,

*::before,

*::after {

  box-sizing: border-box;

}



.page-live {

  background: #081120;

  color: #f8fafc;

}



.live-page {

  width: 100%;

  min-height: 100vh;

  padding: 18px;

  background:

    radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.16), transparent 34%),

    radial-gradient(circle at 90% 10%, rgba(250, 204, 21, 0.09), transparent 30%),

    linear-gradient(135deg, #07101f 0%, #0f172a 50%, #020617 100%);

}



/* =========================================================

   HEADER / HERO

========================================================= */



.live-hero {

  display: flex;

  justify-content: space-between;

  align-items: center;

  gap: 18px;

  margin-bottom: 12px;

  padding: 18px 20px;

  border-radius: 24px;

  border: 1px solid rgba(148, 163, 184, 0.22);

  background: rgba(15, 23, 42, 0.72);

  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);

}



.live-kicker {

  margin-bottom: 5px;

  color: #38bdf8;

  font-size: 12px;

  font-weight: 950;

  letter-spacing: 0.16em;

  text-transform: uppercase;

}



.live-hero h1 {

  margin: 0;

  color: #fff;

  font-size: clamp(26px, 3vw, 48px);

  line-height: 1.02;

  font-weight: 950;

  letter-spacing: -0.04em;

}



.live-meta {

  display: flex;

  flex-wrap: wrap;

  gap: 7px;

  margin-top: 10px;

}



.live-meta span {

  padding: 5px 10px;

  border-radius: 999px;

  background: rgba(148, 163, 184, 0.14);

  color: #cbd5e1;

  font-size: 12px;

  font-weight: 800;

}



.live-status-box {

  display: flex;

  align-items: center;

  gap: 10px;

  min-width: 150px;

  padding: 11px 13px;

  border-radius: 18px;

  border: 1px solid rgba(34, 197, 94, 0.38);

  background: rgba(2, 6, 23, 0.45);

}



.live-dot {

  width: 13px;

  height: 13px;

  border-radius: 999px;

  background: #22c55e;

  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.16);

}



.live-status-label {

  color: #bbf7d0;

  font-size: 13px;

  font-weight: 950;

}



.live-refresh-text {

  color: #94a3b8;

  font-size: 12px;

  font-weight: 700;

}



/* =========================================================

   TOP CONTROL CARDS

========================================================= */



.live-control-bar {

  display: grid;

  grid-template-columns: 360px 1fr;

  align-items: stretch;

  gap: 12px;

  margin-bottom: 12px;

}



.results-tabs-card,

.live-round-card {

  width: 100%;

  padding: 11px 13px;

  border-radius: 18px;

  border: 1px solid rgba(148, 163, 184, 0.22);

  background: rgba(15, 23, 42, 0.72);

  box-shadow:

    inset 0 1px 0 rgba(255,255,255,0.04),

    0 12px 28px rgba(0,0,0,0.16);

}



.live-round-card-title {

  margin-bottom: 8px;

  color: #8fb3da;

  font-size: 10px;

  font-weight: 950;

  letter-spacing: 0.14em;

  text-transform: uppercase;

}



.results-tabs,

.live-round-controls,

.live-round-pills {

  display: flex;

  align-items: center;

  flex-wrap: wrap;

  gap: 7px;

}



.live-round-controls,

.live-round-pills {

  width: 100%;

}



.live-round-pills {

  flex: 1;

}



.results-tab,

.live-round-pill {

  appearance: none;

  min-width: 44px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  border: 1px solid rgba(148, 163, 184, 0.24);

  border-radius: 999px;

  background: rgba(15, 23, 42, 0.78);

  color: #cbd5e1;

  padding: 8px 14px;

  font-size: 13px;

  font-weight: 900;

  line-height: 1;

  cursor: pointer;

  transition: 0.18s ease;

}



.results-tab:hover,

.live-round-pill:hover {

  border-color: rgba(255, 255, 255, 0.38);

  color: #fff;

}



.results-tab.active {

  background: #fff;

  color: #020617;

  border-color: #fff;

  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);

}



.live-round-pill.active {

  background: #38bdf8;

  color: #020617;

  border-color: #38bdf8;

  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14);

}



/* =========================================================

   LEADER STRIP

========================================================= */



.live-leader-strip {

  display: grid;

  grid-template-columns: auto minmax(0, 1fr) auto;

  align-items: center;

  gap: 16px;

  margin-bottom: 14px;

  padding: 12px 16px;

  border-radius: 20px;

  border: 1px solid rgba(250, 204, 21, 0.34);

  background:

    linear-gradient(90deg, rgba(250, 204, 21, 0.20), rgba(15, 23, 42, 0.80)),

    rgba(15, 23, 42, 0.85);

  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);

}



.leader-label {

  color: #fde68a;

  font-size: 12px;

  font-weight: 950;

  text-transform: uppercase;

  letter-spacing: 0.14em;

}



.leader-name {

  min-width: 0;

  color: #fff;

  font-size: clamp(20px, 2.4vw, 36px);

  font-weight: 950;

  line-height: 1;

  letter-spacing: -0.035em;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;

}



.leader-name span {

  margin-left: 10px;

  color: #cbd5e1;

  font-size: 0.45em;

  font-weight: 900;

  letter-spacing: 0;

}



.leader-score {

  display: grid;

  place-items: center;

  min-width: 64px;

  padding: 8px 16px;

  border-radius: 999px;

  background: #fff;

  color: #020617;

  font-size: clamp(24px, 3vw, 44px);

  font-weight: 950;

  line-height: 1;

}



/* =========================================================

   RESULTS

========================================================= */



.live-results-card {

  width: 100%;

}



.live-results-header {

  display: flex;

  justify-content: space-between;

  align-items: end;

  margin-bottom: 10px;

}



.live-results-header h2 {

  margin: 0;

  color: #fff;

  font-size: 25px;

  font-weight: 950;

  letter-spacing: -0.03em;

}



.live-subtitle,

.live-clock,

.live-loading {

  color: #94a3b8;

  font-size: 13px;

  font-weight: 700;

}



.results-table-wrapper {

  width: 100%;

}



/* =========================================================

   CARD GRID

========================================================= */



.live-card-grid {

  width: 100%;

  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  align-items: start;

  gap: 10px;

}



.live-pilot-card {

  position: relative;

  min-width: 0;

  min-height: 126px;

  display: grid;

  grid-template-columns: 42px minmax(0, 1fr) auto;

  grid-template-areas:

    "rank info score"

    "rounds rounds rounds"

    "total total total";

  gap: 8px 10px;

  align-items: center;

  padding: 12px;

  border-radius: 19px;

  border: 1px solid rgba(148, 163, 184, 0.20);

  background:

    linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(2, 6, 23, 0.98));

  box-shadow:

    0 14px 34px rgba(0, 0, 0, 0.25),

    inset 0 1px 0 rgba(255,255,255,0.05);

  overflow: hidden;

}



.live-pilot-card::before {

  content: "";

  position: absolute;

  inset: 0 auto 0 0;

  width: 5px;

  background: rgba(148, 163, 184, 0.35);

}



.live-pilot-card.rank-gold::before {

  background: #facc15;

}



.live-pilot-card.rank-silver::before {

  background: #e5e7eb;

}



.live-pilot-card.rank-bronze::before {

  background: #fb923c;

}



.pilot-rank {

  grid-area: rank;

  width: 38px;

  height: 38px;

  display: grid;

  place-items: center;

  border-radius: 14px;

  background: rgba(148, 163, 184, 0.15);

  color: #fff;

  font-size: 17px;

  font-weight: 950;

}



.rank-gold .pilot-rank {

  background: #facc15;

  color: #111827;

}



.rank-silver .pilot-rank {

  background: #e5e7eb;

  color: #111827;

}



.rank-bronze .pilot-rank {

  background: #fb923c;

  color: #111827;

}



.pilot-info {

  grid-area: info;

  min-width: 0;

}



.pilot-name {

  color: #fff;

  font-size: clamp(16px, 1.24vw, 23px);

  font-weight: 950;

  line-height: 1.08;

  letter-spacing: -0.035em;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;

}



.pilot-meta {

  display: flex;

  gap: 7px;

  flex-wrap: wrap;

  min-height: 16px;

  margin-top: 4px;

  color: #9fb1c9;

  font-size: 11px;

  font-weight: 900;

}



.pilot-meta span {

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;

}



.pilot-score-main {

  grid-area: score;

  min-width: 76px;

  text-align: right;

}



.pilot-score-main span {

  display: block;

  margin-bottom: 3px;

  color: #8fb3da;

  font-size: 10px;

  font-weight: 950;

  text-transform: uppercase;

  letter-spacing: 0.05em;

}



.pilot-score-main strong {

  display: inline-grid;

  place-items: center;

  min-width: 60px;

  padding: 5px 11px;

  border-radius: 999px;

  background: #fff;

  color: #020617;

  font-size: clamp(21px, 1.8vw, 32px);

  font-weight: 950;

  line-height: 1;

}



.pilot-rounds {

  grid-area: rounds;

  display: flex;

  flex-wrap: wrap;

  gap: 5px;

  min-width: 0;

  overflow: visible;

}



.score-pill {

  flex: 0 0 auto;

  min-width: 58px;

  display: inline-flex;

  justify-content: space-between;

  gap: 4px;

  padding: 5px 7px;

  border-radius: 999px;

  background: rgba(148, 163, 184, 0.13);

  color: #e2e8f0;

  font-size: 11px;

  font-weight: 950;

  line-height: 1;

}



.score-pill b {

  color: #91a7c4;

}



.score-pill.active {

  background: #38bdf8;

  color: #020617;

}



.score-pill.active b {

  color: #020617;

}



.score-pill.empty {

  opacity: 0.45;

}



.pilot-total-small {

  grid-area: total;

  display: flex;

  justify-content: flex-end;

  color: #94a3b8;

  font-size: 11px;

  font-weight: 900;

}



.pilot-total-small strong {

  margin-left: 5px;

  color: #fff;

}



/* =========================================================

   NORMAL LIVE BOARD

========================================================= */



body.page-live:not(.page-live-tv) .live-page {

  width: 100%;

  max-width: 1680px;

  margin: 0 auto;

  padding: 24px;

}



body.page-live:not(.page-live-tv) .live-card-grid {

  grid-template-columns: repeat(3, minmax(0, 1fr));

}



@media (min-width: 1500px) {

  body.page-live:not(.page-live-tv) .live-card-grid {

    grid-template-columns: repeat(4, minmax(0, 1fr));

  }

}



/* =========================================================

   TV MODE

========================================================= */



body.page-live-tv {

  width: 100vw;

  height: 100vh;

  margin: 0;

  padding: 0;

  overflow: hidden;

  background: #020617;

}



body.page-live-tv .live-page {

  width: 100vw;

  height: 100vh;

  min-height: 100vh;

  max-width: none;

  padding: 8px;

  display: flex;

  flex-direction: column;

  overflow: hidden;

}



body.page-live-tv .live-back-btn {

  position: fixed;

  top: 8px;

  left: 8px;

  z-index: 20;

  padding: 5px 9px;

  border-radius: 999px;

  background: rgba(15, 23, 42, 0.75);

  color: #cbd5e1;

  text-decoration: none;

  font-size: 11px;

  font-weight: 800;

  opacity: 0.25;

}



body.page-live-tv .live-back-btn:hover {

  opacity: 1;

}



body.page-live-tv .live-hero {

  flex: 0 0 auto;

  margin-bottom: 7px;

  padding: 12px 15px;

  border-radius: 18px;

}



body.page-live-tv .live-hero h1 {

  font-size: clamp(24px, 2.4vw, 42px);

}



body.page-live-tv .live-meta {

  margin-top: 7px;

}



body.page-live-tv .live-meta span {

  padding: 4px 8px;

  font-size: 11px;

}



body.page-live-tv .live-status-box {

  min-width: 132px;

  padding: 8px 10px;

  border-radius: 14px;

}



body.page-live-tv .live-control-bar {

  flex: 0 0 auto;

  display: grid;

  grid-template-columns: minmax(300px, auto) 1fr;

  align-items: stretch;

  gap: 8px;

  margin-bottom: 7px;

}



body.page-live-tv .results-tabs-card,

body.page-live-tv .live-round-card {

  padding: 9px 11px;

  border-radius: 16px;

}



body.page-live-tv .results-tab,

body.page-live-tv .live-round-pill {

  padding: 6px 11px;

  font-size: 11px;

}



body.page-live-tv .live-leader-strip {

  flex: 0 0 auto;

  margin-bottom: 7px;

  padding: 9px 12px;

  border-radius: 16px;

}



body.page-live-tv .leader-name {

  font-size: clamp(21px, 2.25vw, 34px);

}



body.page-live-tv .leader-score {

  min-width: 58px;

  padding: 7px 14px;

  font-size: clamp(25px, 2.75vw, 42px);

}



body.page-live-tv .live-results-card {

  flex: 1 1 auto;

  min-height: 0;

  overflow: hidden;

}



body.page-live-tv .live-results-header {

  flex: 0 0 auto;

  margin-bottom: 6px;

}



body.page-live-tv .live-results-header h2 {

  font-size: 18px;

}



body.page-live-tv .live-subtitle,

body.page-live-tv .live-clock {

  font-size: 11px;

}



body.page-live-tv .results-table-wrapper {

  height: 100%;

  min-height: 0;

  overflow: hidden;

}



body.page-live-tv .live-card-grid {

  height: auto;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  grid-auto-rows: auto;

  align-content: start;

  gap: 7px;

}



body.page-live-tv .live-pilot-card {

  min-height: 78px;

  grid-template-columns: 34px minmax(0, 1fr) auto;

  padding: 8px 9px;

  border-radius: 15px;

  gap: 5px 8px;

}



body.page-live-tv .pilot-rank {

  width: 30px;

  height: 30px;

  border-radius: 11px;

  font-size: 14px;

}



body.page-live-tv .pilot-name {

  font-size: clamp(14px, 1vw, 19px);

}



body.page-live-tv .pilot-meta {

  margin-top: 2px;

  font-size: 9px;

}



body.page-live-tv .pilot-score-main {

  min-width: 58px;

}



body.page-live-tv .pilot-score-main span {

  font-size: 8px;

}



body.page-live-tv .pilot-score-main strong {

  min-width: 48px;

  padding: 4px 8px;

  font-size: clamp(17px, 1.35vw, 25px);

}



body.page-live-tv .score-pill {

  min-width: 40px;

  padding: 3px 5px;

  font-size: 9px;

}



/* =========================================================

   RESPONSIVE

========================================================= */



@media (min-width: 2100px) {

  .live-card-grid,

  body.page-live-tv .live-card-grid {

    grid-template-columns: repeat(5, minmax(0, 1fr));

  }

}



@media (max-width: 1550px) {

  .live-card-grid,

  body.page-live-tv .live-card-grid {

    grid-template-columns: repeat(3, minmax(0, 1fr));

  }

}



@media (max-width: 1200px) {

  body.page-live:not(.page-live-tv) .live-control-bar,

  body.page-live-tv .live-control-bar {

    grid-template-columns: 1fr;

  }



  body.page-live:not(.page-live-tv) .live-card-grid {

    grid-template-columns: repeat(2, minmax(0, 1fr));

  }

}



@media (max-width: 1050px) {

  .live-leader-strip {

    grid-template-columns: 1fr auto;

  }



  .leader-label {

    grid-column: 1 / -1;

  }



  .live-card-grid,

  body.page-live-tv .live-card-grid {

    grid-template-columns: repeat(2, minmax(0, 1fr));

  }

}



@media (max-width: 680px) {

  .live-page,

  body.page-live:not(.page-live-tv) .live-page,

  body.page-live-tv .live-page {

    padding: 8px;

  }



  .live-hero {

    align-items: flex-start;

    flex-direction: column;

  }



  .live-card-grid,

  body.page-live:not(.page-live-tv) .live-card-grid,

  body.page-live-tv .live-card-grid {

    grid-template-columns: 1fr;

  }



  .live-pilot-card {

    grid-template-columns: 36px minmax(0, 1fr) auto;

  }



  .live-leader-strip {

    grid-template-columns: 1fr;

  }



  .leader-score {

    width: fit-content;

  }

}

/* Dropped worst result visualization */

.score-pill.dropped {

  position: relative;

  opacity: 0.62;

  background: rgba(248, 113, 113, 0.14);

  border: 1px solid rgba(248, 113, 113, 0.46);

  color: #fecaca;

  text-decoration: line-through;

  text-decoration-thickness: 2px;

}



.score-pill.dropped b {

  color: #fecaca;

}



.score-pill.dropped::after {

  content: "drop";

  position: absolute;

  top: -9px;

  right: -4px;

  padding: 1px 5px;

  border-radius: 999px;

  background: #ef4444;

  color: #fff;

  font-size: 8px;

  font-weight: 900;

  line-height: 1.1;

  text-decoration: none;

}



/* STEP 9: pilot flag and wing details */

.pilot-name {

  display: inline-flex;

  align-items: center;

  gap: 6px;

}



.pilot-flag,

.leader-flag {

  flex: 0 0 auto;

  width: 22px;

  height: 16px;

  display: inline-block;

  object-fit: cover;

  border-radius: 3px;

  box-shadow: 0 0 0 1px rgba(255,255,255,.22);

}



.pilot-meta .pilot-wing {

  color: #93c5fd;

  font-weight: 800;

}



/* Dynamic wing color SVG */

.wing-mini {

  display: inline-flex;

  align-items: center;

  justify-content: center;

  width: 34px;

  min-width: 34px;

  height: 20px;

  vertical-align: middle;

}



.wing-mini svg {

  width: 34px;

  height: 20px;

  display: block;

  filter: drop-shadow(0 2px 5px rgba(0,0,0,.35));

}



.wing-mini .wing-shadow {

  fill: rgba(0,0,0,.35);

}



.pilot-wing {

  display: inline-flex;

  align-items: center;

  gap: 6px;

}



.wing-mini-leader {

  margin-left: 8px;

}



/* STEP 9D: labeled wing manufacturer/model/color */

.pilot-country,

.pilot-wing-details {

  display: inline-flex;

  align-items: center;

  gap: 5px;

}



.pilot-country-flag {

  flex: 0 0 auto;

  width: 18px;

  height: 13px;

  display: inline-block;

  object-fit: cover;

  border-radius: 2px;

  box-shadow: 0 0 0 1px rgba(255,255,255,.22);

}



.pilot-wing-details {

  flex-wrap: wrap;

  gap: 5px 8px;

}



.pilot-wing-details .wing-detail-list {

  display: inline-flex;

  flex-wrap: wrap;

  align-items: center;

  gap: 4px 8px;

}



.pilot-wing-details .wing-detail {

  display: inline-flex;

  align-items: center;

  gap: 4px;

}



.pilot-wing-details .wing-label {

  color: rgba(255,255,255,.55);

  font-size: .62rem;

  font-weight: 900;

  letter-spacing: .045em;

  text-transform: uppercase;

}



.pilot-wing-details .wing-value {

  color: #dbeafe;

  font-size: .78rem;

  font-weight: 800;

}



.pilot-wing-details-leader {

  margin-top: 4px;

}


/* Step 22: live open-round/disqualified visibility */
.live-subtitle.is-open {
  color: #fbbf24;
  font-weight: 700;
}
.live-disqualified-box {
  margin-top: 18px;
  border: 1px solid rgba(248, 113, 113, .38);
  background: rgba(127, 29, 29, .18);
  border-radius: 18px;
  padding: 16px;
}
.live-disqualified-box h3 {
  margin: 0 0 10px;
  color: #fecaca;
}
.live-disqualified-list {
  display: grid;
  gap: 8px;
}
.live-disqualified-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  border-radius: 12px;
  padding: 10px 12px;
}
.live-disqualified-item span {
  opacity: .78;
}
@media (max-width: 720px) {
  .live-disqualified-item { flex-direction: column; }
}

/* Step 23: live mode and consistent cards */
.live-pilot-card { min-height: 260px; height: 100%; }
.live-card-grid { align-items: stretch; }
.live-mode-card .live-round-controls { flex-wrap: wrap; }
.live-subtitle.is-open { color: #fbbf24; }
.pilot-meta span { overflow-wrap: anywhere; }

/* Step 26: not-flown marker for open/live result view */
.score-pill.not-flown {
  border-color: rgba(250, 204, 21, .7) !important;
  background: rgba(250, 204, 21, .12) !important;
  color: #fde68a !important;
  font-weight: 800;
}
.venue-map-link { color: #93c5fd; font-weight: 800; text-decoration: none; }
.venue-map-link:hover { text-decoration: underline; }

/* =========================================================
   STEP 30 - TV MODE FULL-SCREEN AUTO-FIT
   Keeps the TV board inside the viewport and uses the full screen.
========================================================= */

body.page-live-tv,
body.page-live-tv * {
  box-sizing: border-box;
}

body.page-live-tv {
  width: 100dvw;
  height: 100dvh;
  max-width: 100dvw;
  max-height: 100dvh;
  overflow: hidden;
}

body.page-live-tv .live-page-tv {
  --tv-grid-columns: 4;
  --tv-card-height: 128px;
  --tv-card-scale: 1;
  --tv-grid-gap: 10px;
  width: 100dvw;
  height: 100dvh;
  max-width: none;
  padding: clamp(4px, 0.55vw, 10px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.45vw, 8px);
  overflow: hidden;
}

body.page-live-tv .live-hero {
  flex: 0 0 auto;
  min-height: 0;
  margin: 0;
  padding: clamp(6px, 0.65vw, 12px) clamp(8px, 0.9vw, 16px);
  border-radius: clamp(12px, 1vw, 18px);
  gap: clamp(8px, 1vw, 16px);
}

body.page-live-tv .live-kicker {
  margin-bottom: 2px;
  font-size: clamp(8px, 0.62vw, 12px);
}

body.page-live-tv .live-hero h1 {
  max-width: 78vw;
  font-size: clamp(18px, 2.05vw, 38px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.page-live-tv .live-meta {
  margin-top: 4px;
  gap: 4px;
}

body.page-live-tv .live-meta span,
body.page-live-tv .venue-map-link {
  padding: 3px 7px;
  font-size: clamp(8px, 0.55vw, 11px);
  line-height: 1;
}

body.page-live-tv .live-status-box {
  min-width: auto;
  padding: clamp(5px, 0.55vw, 8px) clamp(7px, 0.7vw, 10px);
  border-radius: 13px;
}

body.page-live-tv .live-dot {
  width: 10px;
  height: 10px;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

body.page-live-tv .live-status-label {
  font-size: clamp(9px, 0.65vw, 12px);
}

body.page-live-tv .live-refresh-text {
  font-size: clamp(8px, 0.55vw, 10px);
}

body.page-live-tv .live-control-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(160px, 0.55fr) minmax(0, 1fr);
  gap: clamp(4px, 0.45vw, 7px);
  margin: 0;
}

body.page-live-tv .results-tabs-card,
body.page-live-tv .live-round-card {
  min-width: 0;
  padding: clamp(5px, 0.55vw, 8px) clamp(7px, 0.7vw, 10px);
  border-radius: 13px;
}

body.page-live-tv .live-round-card-title {
  margin-bottom: 4px;
  font-size: clamp(7px, 0.48vw, 9px);
}

body.page-live-tv .results-tabs,
body.page-live-tv .live-round-controls,
body.page-live-tv .live-round-pills {
  gap: 4px;
}

body.page-live-tv .results-tab,
body.page-live-tv .live-round-pill {
  min-width: 34px;
  padding: clamp(4px, 0.42vw, 6px) clamp(7px, 0.62vw, 10px);
  font-size: clamp(8px, 0.56vw, 10px);
}

body.page-live-tv .live-leader-strip {
  flex: 0 0 auto;
  margin: 0;
  padding: clamp(5px, 0.6vw, 9px) clamp(8px, 0.8vw, 12px);
  border-radius: 13px;
  gap: clamp(6px, 0.75vw, 12px);
}

body.page-live-tv .leader-label {
  font-size: clamp(8px, 0.56vw, 10px);
}

body.page-live-tv .leader-name {
  font-size: clamp(15px, 1.55vw, 28px);
}

body.page-live-tv .leader-score {
  min-width: 50px;
  padding: 5px 11px;
  font-size: clamp(18px, 2vw, 34px);
}

body.page-live-tv .live-results-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-live-tv .live-results-header {
  flex: 0 0 auto;
  margin: 0 0 clamp(4px, 0.4vw, 7px);
  align-items: center;
}

body.page-live-tv .live-results-header h2 {
  font-size: clamp(14px, 1.1vw, 20px);
}

body.page-live-tv .live-subtitle,
body.page-live-tv .live-clock {
  font-size: clamp(8px, 0.58vw, 11px);
}

body.page-live-tv .results-table-wrapper {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

body.page-live-tv .live-card-grid {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--tv-grid-columns), minmax(0, 1fr));
  grid-auto-rows: minmax(0, var(--tv-card-height));
  align-content: start;
  align-items: stretch;
  gap: var(--tv-grid-gap);
  overflow: hidden;
}

body.page-live-tv .live-pilot-card {
  height: 100%;
  min-height: 0;
  grid-template-columns: calc(34px * var(--tv-card-scale)) minmax(0, 1fr) auto;
  grid-template-areas:
    "rank info score"
    "rounds rounds rounds";
  gap: calc(5px * var(--tv-card-scale)) calc(8px * var(--tv-card-scale));
  padding: calc(8px * var(--tv-card-scale));
  border-radius: calc(15px * var(--tv-card-scale));
  overflow: hidden;
}

body.page-live-tv .pilot-rank {
  width: calc(30px * var(--tv-card-scale));
  height: calc(30px * var(--tv-card-scale));
  border-radius: calc(11px * var(--tv-card-scale));
  font-size: calc(14px * var(--tv-card-scale));
}

body.page-live-tv .pilot-name {
  font-size: clamp(14px, calc(19px * var(--tv-card-scale)), 24px);
  line-height: 1.02;
}

body.page-live-tv .pilot-meta {
  gap: calc(4px * var(--tv-card-scale));
  margin-top: calc(2px * var(--tv-card-scale));
  font-size: clamp(9px, calc(11px * var(--tv-card-scale)), 13px);
  line-height: 1.05;
}

body.page-live-tv .pilot-wing-details {
  max-width: 100%;
}

body.page-live-tv .wing-mini {
  width: calc(28px * var(--tv-card-scale));
  min-width: calc(28px * var(--tv-card-scale));
}

body.page-live-tv .wing-detail-list {
  min-width: 0;
  overflow: hidden;
}

body.page-live-tv .wing-detail {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.page-live-tv .pilot-score-main {
  min-width: calc(52px * var(--tv-card-scale));
}

body.page-live-tv .pilot-score-main span {
  margin-bottom: 2px;
  font-size: clamp(8px, calc(9px * var(--tv-card-scale)), 11px);
}

body.page-live-tv .pilot-score-main strong {
  min-width: calc(44px * var(--tv-card-scale));
  padding: calc(4px * var(--tv-card-scale)) calc(8px * var(--tv-card-scale));
  font-size: clamp(18px, calc(24px * var(--tv-card-scale)), 30px);
}

body.page-live-tv .pilot-rounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(calc(34px * var(--tv-card-scale)), 1fr));
  gap: calc(4px * var(--tv-card-scale));
  overflow: hidden;
}

body.page-live-tv .score-pill {
  min-width: 0;
  width: 100%;
  padding: calc(3px * var(--tv-card-scale)) calc(5px * var(--tv-card-scale));
  gap: 2px;
  font-size: clamp(9px, calc(10px * var(--tv-card-scale)), 12px);
  line-height: 1;
}

body.page-live-tv .pilot-total-small {
  display: none;
}

body.page-live-tv .live-disqualified-box {
  display: none;
}

body.page-live-tv .live-page-tv[data-tv-density="compact"] .wing-label,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .wing-label {
  display: none;
}

body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-meta,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-kicker,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-round-card-title,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .leader-label {
  display: none;
}

body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-hero,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-leader-strip,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .results-tabs-card,
body.page-live-tv .live-page-tv[data-tv-density="ultra"] .live-round-card {
  padding: 4px 7px;
}

body.page-live-tv .live-page-tv[data-tv-density="ultra"] .pilot-meta .pilot-wing-details {
  display: none;
}

body.page-live-tv .live-page-tv[data-tv-density="ultra"] .pilot-meta .pilot-wing-details {
  display: flex;
}

@media (max-aspect-ratio: 4/3) {
  body.page-live-tv .live-control-bar {
    grid-template-columns: 1fr;
  }

  body.page-live-tv .live-hero h1 {
    max-width: 70vw;
  }
}

/* =========================================================
   STEP 32 - TV AUTO-SPLIT PAGING AT 25 PILOTS
   If there are too many pilots/rounds to show readably, TV mode
   splits the ranking into screens of max 25 pilots and rotates automatically.
========================================================= */

body.page-live-tv .tv-page-indicator {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 0.7vw, 14px);
  margin: 0 0 clamp(4px, 0.4vw, 7px);
  padding: clamp(4px, 0.45vw, 7px) clamp(8px, 0.8vw, 14px);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.10);
  color: #bae6fd;
  font-size: clamp(8px, 0.62vw, 12px);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.page-live-tv .tv-page-indicator strong {
  color: #fff;
  font-weight: 950;
}

body.page-live-tv .tv-page-indicator small {
  color: #93c5fd;
  font-size: inherit;
  font-weight: 800;
  opacity: 0.82;
}

body.page-live-tv .live-card-grid {
  transition: opacity 0.22s ease;
}

@media (max-width: 900px) {
  body.page-live-tv .tv-page-indicator {
    flex-wrap: wrap;
    border-radius: 14px;
  }
}

/* =========================================================
   STEP 32 FINAL OVERRIDES - TV readability with max 25 pilots
========================================================= */
body.page-live-tv .live-page-tv {
  --tv-card-height: 128px;
  --tv-card-scale: max(0.72, var(--tv-card-scale));
  --tv-grid-gap: 10px;
}

body.page-live-tv .live-card-grid {
  grid-auto-rows: minmax(96px, var(--tv-card-height));
}

body.page-live-tv .pilot-name {
  font-size: clamp(14px, calc(19px * var(--tv-card-scale)), 24px);
}

body.page-live-tv .pilot-meta {
  font-size: clamp(9px, calc(11px * var(--tv-card-scale)), 13px);
}

body.page-live-tv .pilot-score-main strong {
  font-size: clamp(18px, calc(24px * var(--tv-card-scale)), 30px);
}

body.page-live-tv .score-pill {
  font-size: clamp(9px, calc(10px * var(--tv-card-scale)), 12px);
}

body.page-live-tv .live-page-tv[data-tv-density="ultra"] .pilot-meta .pilot-wing-details,
body.page-live-tv .live-page-tv[data-tv-density="compact"] .pilot-meta .pilot-wing-details {
  display: flex;
}


/* =========================================================
   STEP 34 - TV readability: 20 pilots per page + fixed grid height
   Prevents bottom row clipping and keeps last pages consistent.
========================================================= */
body.page-live-tv .results-table-wrapper {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.45vw, 7px);
  overflow: hidden;
}

body.page-live-tv .live-card-grid {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  grid-auto-rows: minmax(104px, var(--tv-card-height));
  padding-bottom: 2px;
}

body.page-live-tv .live-pilot-card {
  min-height: 0;
  max-height: var(--tv-card-height);
}

body.page-live-tv .pilot-rounds {
  min-height: 0;
  align-self: end;
  grid-template-columns: repeat(auto-fit, minmax(calc(30px * var(--tv-card-scale)), 1fr));
}

body.page-live-tv .score-pill {
  min-height: 0;
  padding: calc(2.5px * var(--tv-card-scale)) calc(4px * var(--tv-card-scale));
}

body.page-live-tv .score-pill b {
  font-size: 0.82em;
}

body.page-live-tv .live-disqualified-box {
  flex: 0 0 auto;
  display: block;
  margin: 0;
  padding: clamp(5px, 0.5vw, 8px) clamp(8px, 0.75vw, 12px);
  border-radius: 13px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.18);
}

body.page-live-tv .live-disqualified-box h3 {
  margin: 0 0 4px;
  font-size: clamp(8px, 0.6vw, 11px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fecaca;
}

body.page-live-tv .live-disqualified-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
}

body.page-live-tv .live-disqualified-item {
  min-width: 0;
  max-width: 280px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.page-live-tv .live-disqualified-item strong,
body.page-live-tv .live-disqualified-item span {
  display: inline;
  font-size: clamp(8px, 0.58vw, 11px);
  line-height: 1;
}

body.page-live-tv .live-disqualified-item span::before {
  content: ' · ';
}

body.page-live-tv .live-page-tv[data-many-rounds="1"] .pilot-meta .pilot-wing-details {
  display: none;
}

body.page-live-tv .live-page-tv[data-many-rounds="1"] .pilot-rounds {
  grid-template-columns: repeat(auto-fit, minmax(calc(25px * var(--tv-card-scale)), 1fr));
}

body.page-live-tv .live-page-tv[data-many-rounds="1"] .score-pill {
  gap: 1px;
  font-size: clamp(7px, calc(8.5px * var(--tv-card-scale)), 10px);
}

body.page-live-tv .live-page-tv[data-many-rounds="1"] .score-pill b {
  font-size: 0.76em;
}
