:root {
  --page-bg: #ffffff;
  --text: #2d241e;
  --muted: #72675f;
  --line: #e8e2dc;
  --panel: #ffffff;
  --soft-panel: #f8f6f3;
  --dbsa-yellow: #f2b61f;
  --dbsa-brown: #4a2d1c;
  --shadow: 0 10px 28px rgba(61, 42, 29, 0.10);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.display-shell {
  width: min(100%, 1920px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 34px);
  background: #ffffff;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(12px, 1.4vw, 22px);
}

.display-header {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: clamp(14px, 2vw, 34px);
  padding: 4px 2px 10px;
  background: #ffffff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.dbsa-logo {
  display: block;
  width: clamp(105px, 11vw, 185px);
  max-height: 92px;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.title-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 14px);
  text-align: left;
  min-width: 0;
}

.trophy {
  flex: 0 0 auto;
  font-size: clamp(28px, 3vw, 50px);
  line-height: 1;
}

.title-lockup h1 {
  margin: 0;
  color: var(--dbsa-brown);
  font-size: clamp(28px, 3.3vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.title-lockup p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.05vw, 18px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.title-lockup p span {
  color: var(--dbsa-yellow);
  padding: 0 0.25em;
}

.event-label {
  justify-self: end;
  padding: 10px 16px;
  border: 2px solid var(--dbsa-brown);
  border-radius: 999px;
  color: var(--dbsa-brown);
  background: #ffffff;
  font-size: clamp(11px, 0.95vw, 16px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.column-headings,
.leaderboard-row {
  display: grid;
  grid-template-columns: 86px minmax(240px, 1.15fr) minmax(290px, 1.65fr) 140px;
  align-items: center;
  gap: clamp(12px, 1.4vw, 24px);
}

.column-headings {
  padding: 0 20px;
  color: var(--muted);
  font-size: clamp(10px, 0.8vw, 13px);
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.column-headings span:last-child {
  text-align: right;
}

.leaderboard {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: clamp(9px, 0.85vw, 15px);
}

.leaderboard-row {
  --team-color: var(--dbsa-yellow);
  position: relative;
  min-width: 0;
  padding: clamp(13px, 1.1vw, 19px) clamp(15px, 1.5vw, 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 8px solid var(--team-color);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 260ms ease, box-shadow 260ms ease;
}

.leaderboard-row::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--team-color) 8%, transparent), transparent 28%);
}

.rank-cell,
.identity-cell,
.progress-cell,
.score-cell {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.rank-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.rank-number {
  display: grid;
  place-items: center;
  width: clamp(43px, 3.4vw, 58px);
  aspect-ratio: 1;
  border-radius: 50%;
  color: #ffffff;
  background: var(--dbsa-brown);
  font-size: clamp(20px, 1.8vw, 31px);
  font-weight: 900;
  line-height: 1;
}

.rank-change {
  min-width: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.identity-cell {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.05vw, 17px);
}

.station-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(46px, 4vw, 66px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  color: #ffffff;
  background: var(--team-color);
  font-size: clamp(23px, 2.1vw, 35px);
  font-weight: 900;
}

.station-icon img,
.station-icon svg {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

.identity-copy {
  min-width: 0;
}

.station-line {
  margin-bottom: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(10px, 0.9vw, 14px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.team-name {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(18px, 1.75vw, 31px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-cell {
  display: grid;
  gap: 8px;
}

.progress-track {
  position: relative;
  height: clamp(17px, 1.4vw, 25px);
  overflow: hidden;
  border: 1px solid #ddd6d0;
  border-radius: 999px;
  background: #eeeae6;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: var(--team-color);
  transition: width 650ms cubic-bezier(.2, .75, .25, 1);
}

.progress-gloss {
  position: absolute;
  inset: 1px 2px auto 2px;
  height: 40%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.30);
  pointer-events: none;
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.percent-value {
  color: var(--dbsa-brown);
  font-size: clamp(15px, 1.25vw, 21px);
  font-weight: 900;
  white-space: nowrap;
}

.target-status {
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(10px, 0.8vw, 13px);
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
}

.score-value {
  color: var(--dbsa-brown);
  font-size: clamp(25px, 2.3vw, 40px);
  line-height: 1;
  letter-spacing: -0.035em;
}

.score-target {
  margin-top: 5px;
  color: var(--muted);
  font-size: clamp(10px, 0.88vw, 14px);
  font-weight: 700;
  white-space: nowrap;
}

.display-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 6px 0;
  color: var(--muted);
  font-size: clamp(11px, 0.9vw, 15px);
  font-weight: 700;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ebd68;
  box-shadow: 0 0 0 5px rgba(46, 189, 104, 0.13);
}

@media (max-width: 1000px) {
  .display-header {
    grid-template-columns: 150px 1fr auto;
  }

  .column-headings,
  .leaderboard-row {
    grid-template-columns: 70px minmax(180px, 1fr) minmax(230px, 1.3fr) 110px;
  }
}

@media (max-width: 760px) {
  .display-shell {
    display: block;
    padding: 14px;
  }

  .display-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand event"
      "title title";
    gap: 13px;
    padding-bottom: 16px;
  }

  .brand-lockup {
    grid-area: brand;
  }

  .dbsa-logo {
    width: 110px;
    max-height: 70px;
  }

  .title-lockup {
    grid-area: title;
    justify-content: flex-start;
    padding-top: 3px;
  }

  .title-lockup h1 {
    font-size: clamp(31px, 10vw, 48px);
  }

  .title-lockup p {
    font-size: 11px;
  }

  .event-label {
    grid-area: event;
    padding: 8px 11px;
    font-size: 10px;
  }

  .column-headings {
    display: none;
  }

  .leaderboard {
    gap: 12px;
  }

  .leaderboard-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas:
      "rank identity score"
      ". progress progress";
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
    border-left-width: 6px;
    border-radius: 16px;
  }

  .rank-cell {
    grid-area: rank;
    align-self: start;
  }

  .rank-number {
    width: 46px;
    font-size: 22px;
  }

  .rank-change {
    display: none;
  }

  .identity-cell {
    grid-area: identity;
    gap: 10px;
  }

  .station-icon {
    width: 45px;
    border-radius: 13px;
    font-size: 22px;
  }

  .station-line {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .team-name {
    font-size: clamp(17px, 5.1vw, 23px);
  }

  .progress-cell {
    grid-area: progress;
    gap: 6px;
  }

  .progress-track {
    height: 18px;
  }

  .score-cell {
    grid-area: score;
    align-self: start;
  }

  .score-value {
    font-size: 25px;
  }

  .score-target {
    font-size: 10px;
  }

  .percent-value {
    font-size: 16px;
  }

  .target-status {
    font-size: 10px;
  }

  .display-footer {
    margin-top: 14px;
    padding: 4px 2px;
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .display-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "title"
      "event";
  }

  .brand-lockup,
  .title-lockup {
    justify-content: center;
  }

  .title-lockup {
    text-align: center;
  }

  .event-label {
    justify-self: center;
  }

  .leaderboard-row {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      "rank identity"
      "progress progress"
      "score score";
  }

  .rank-number {
    width: 42px;
    font-size: 20px;
  }

  .station-icon {
    width: 41px;
  }

  .score-cell {
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-end;
    gap: 7px;
  }

  .score-target {
    margin-top: 0;
  }

  .display-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* =========================================================
   TEAM COLOURS — restores the original red/orange/green/
   blue/purple/yellow leaderboard treatment.
   team-colors.js assigns the variables by station identity,
   so the colour stays with the correct team when rows reorder.
   ========================================================= */

.leaderboard-row {
  color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-left: 0;
  background:
    repeating-linear-gradient(
      130deg,
      rgba(255, 255, 255, 0.055) 0,
      rgba(255, 255, 255, 0.055) 15px,
      rgba(0, 0, 0, 0.025) 15px,
      rgba(0, 0, 0, 0.025) 30px
    ),
    linear-gradient(90deg, var(--team-dark), var(--team-color));
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.16),
    0 9px 20px rgba(35, 24, 18, 0.12);
}

.leaderboard-row::after {
  display: none;
}

.leaderboard-row .rank-number {
  border: 2px solid rgba(255, 255, 255, 0.94);
  color: #ffffff;
  background: rgba(0, 0, 0, 0.09);
}

.leaderboard-row .rank-change,
.leaderboard-row .station-line,
.leaderboard-row .team-name,
.leaderboard-row .percent-value,
.leaderboard-row .target-status,
.leaderboard-row .score-value,
.leaderboard-row .score-target {
  color: #ffffff;
}

.leaderboard-row .station-line,
.leaderboard-row .target-status,
.leaderboard-row .score-target {
  opacity: 0.92;
}

.leaderboard-row .station-icon {
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.10);
}

.leaderboard-row .progress-track {
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(#313131, #111111);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.65),
    0 1px 0 rgba(255, 255, 255, 0.18);
}

.leaderboard-row .progress-fill {
  background: linear-gradient(90deg, var(--team-light), #ffffff);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.30);
}

.leaderboard-row .progress-gloss {
  background: rgba(255, 255, 255, 0.42);
}

@media (max-width: 760px) {
  .leaderboard-row {
    border-left: 0;
  }
}
