/* =========================================================
   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;
  }
}