/* The live race, in the racecard language.
   The lobby is a board, not a dashboard: the clock is the only large thing on
   it, set in the display face with tabular figures so the digits hold their
   columns as they count. Everything else waits. */

body.live-page {
  margin: 0;
  min-height: 100vh;
  background-color: var(--card-night);
  color: var(--card-rail);
  font-family: var(--font-ui);
  font-size: 15px;
}

.lobby-conditions { padding: 10px 0; border-block: 1px solid var(--identity-gold); max-width: 60ch; margin: 12px auto; color: var(--card-rail); font-weight: 600; line-height: 1.5; }
.live-card-conditions { position: absolute; z-index: 5; bottom: 0; left: 0; right: 0; margin: 0; padding: 8px 12px; background: var(--identity-gloss); border-top: 1px solid var(--identity-gold); color: var(--card-rail); text-align: center; font-size: 14px; font-weight: 600; }

.live-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* ---- the rail across the top ---- */

.live-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid var(--card-rule-strong);
  background-color: var(--card-night);
}

.live-topbar .brand {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.live-topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Going somewhere else is a quiet ruled word. */
a.live-audio-button {
  padding: 2px 0;
  border: 0;
  border-bottom: 2px solid var(--card-rule-strong);
  background: none;
  color: var(--card-chalk);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
}

a.live-audio-button:hover { border-bottom-color: var(--card-silk); color: var(--card-rail); }

/* Turning the call on is the one thing you press here. */
button.live-audio-button {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--card-flood);
  border-radius: 0;
  background: var(--card-night);
  color: var(--card-rail);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
}

button.live-audio-button:hover { background: var(--card-band); }

button.live-audio-button[data-state="armed"] {
  background: none;
  border: 1px solid var(--card-rule-strong);
  color: var(--card-chalk);
}

button.live-audio-button:disabled {
  border-color: var(--card-rule-strong);
  background: none;
  color: var(--card-chalk);
  cursor: not-allowed;
  opacity: 0.6;
}

.live-status { color: var(--card-chalk); font-size: 14px; font-weight: 500; }
.live-status[data-phase="running"] { color: var(--card-flood); }
.live-status[data-phase="locked"] { color: var(--color-red); }

:is(.live-topbar, .live-footer, .live-lobby) :is(a, button):focus-visible {
  outline: 2px solid var(--card-flood);
  outline-offset: 2px;
}

/* ---- the stage ---- */

.live-stage {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--card-night);
  overflow: hidden;
}

#engineFrame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--card-night);
}

#engineFrame[hidden] { display: none; }

/* ---- the lobby board ---- */

.live-lobby {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 48px 24px;
  overflow: hidden;
  background: var(--card-night);
  text-align: center;
}

.live-lobby[hidden] { display: none; }

.live-page #liveLobby {
  inset: 24px auto 64px; left: 50%; transform: translateX(-50%);
  width: min(820px, calc(100% - 28px)); padding: 24px 14px; gap: 14px;
  background: var(--identity-gloss); border: 1px solid var(--identity-gold); border-radius: var(--radius-md);
}
.live-page :is(.lobby-kicker, .lobby-copy, .live-odds p, .live-odds th) { color: var(--card-rail); }
.live-page .ambient-film button { background: var(--identity-gloss); border: 1px solid var(--identity-gold); border-radius: var(--radius-md); }

.lobby-kicker { margin: 0; color: var(--card-chalk); font-size: 14px; font-weight: 500; }

.lobby-countdown {
  margin: 0;
  color: var(--card-rail);
  font-family: var(--font-display);
  font-size: clamp(64px, 15vw, 168px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.86;
}

.lobby-countdown[data-imminent="1"] { color: var(--card-flood); }

.lobby-copy { max-width: 46ch; margin: 0; color: var(--card-chalk); line-height: 1.5; }

/* The field, as it reads on the card: colours, then the name. */
.lobby-field {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  max-width: 74ch;
  min-height: 0;
  margin: 4px 0 0;
  padding: 14px 2px 2px;
  border-top: 1px solid var(--card-rule);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.lobby-field li {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--card-rail);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
}

.lobby-field li::before {
  content: "";
  flex: none;
  width: 11px;
  height: 14px;
  background: var(--card-silk);
  border: 1px solid var(--card-rule-strong);
}

/* ---- the footer strip: chalk labels, figures in the tabular face ---- */

.live-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding: 11px 20px;
  border-top: 1px solid var(--card-rule-strong);
  background: var(--card-night);
  color: var(--card-chalk);
  font-size: 13px;
}

.live-footer b {
  color: var(--card-rail);
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.live-footer #footFrame { font-family: var(--font-data); }

.live-error { color: var(--color-red); }

/* ---- the running book, over the stage ---- */

.live-odds {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: min(290px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: 12px 14px;
  border: 0;
  border-top: 3px solid var(--card-silk);
  border-radius: 0;
  background: var(--card-overlay);
  font-size: 13px;
}

.live-odds[hidden] { display: none; }
.live-odds summary { cursor: pointer; font-weight: 600; }
.live-odds p { margin: 9px 0; color: var(--card-chalk); }
.live-odds table { width: 100%; border-collapse: collapse; }

.live-odds th,
.live-odds td {
  padding: 6px 0;
  border-top: 1px solid var(--card-rule);
  text-align: left;
  overflow-wrap: anywhere;
}

.live-odds th { color: var(--card-chalk); font-size: 12px; font-weight: 500; }

.live-odds th:last-child,
.live-odds td:last-child {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .live-topbar { align-items: flex-start; flex-direction: column; gap: 0; padding: 10px 14px; }
  .live-topbar-right { flex-wrap: wrap; gap: 12px; width: 100%; padding-bottom: 10px; }
  .live-status { margin-left: auto; }
  .lobby-field { gap: 6px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* The kicker is chalk on the board, not an acid label. Scoped here so the
   arcade front door keeps its own. */
.live-page .eyebrow {
  color: var(--card-chalk);
  font-size: 0.85rem;
  font-weight: 500;
}
