/*
 * Live matches board — /live, and the strip on the home page.
 *
 * The card is built to read as a VIDEO PREVIEW at a glance: a 16:9 frame, a
 * blinking LIVE badge, a viewer count, a play glyph. Everything inside the
 * frame is positioned over it, so the card looks identical whether or not
 * Kick actually gave us a thumbnail — the fallback (the matchup, set large in
 * the frame) is a deliberate design, not a hole.
 */

.live-board {
  --live-red: #ff3b30;
  --live-panel: #10141c;
  --live-panel-soft: #161b26;
  --live-border: rgba(255, 255, 255, 0.1);
  --live-text: #f4f6fa;
  --live-text-soft: rgba(255, 255, 255, 0.62);
  --live-orange: #ef5c23;

  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 40px;
  color: var(--live-text);
}

/* Tighter cards and a "See all" link, for a board embedded in a longer page.
   Nothing uses it today -- /live is the only board -- but it is two rules and
   it is what a second placement would want. */
.live-board--compact {
  padding: 24px 20px 28px;
}

/* ------------------------------------------------- inside the standings -- */

/*
 * The home page's live matches, as a SECTION of the standings card.
 *
 * No chrome of its own -- no surface, no border, no radius. It is inside
 * .top-players, and a second card drawn inside the first is exactly the "two
 * things that failed to merge" look this is here to avoid. What separates it
 * from the board above is a rule and some space; what ties it to the board is
 * that its rows are built the same way.
 *
 * Grey and still while nothing is live. Red and pulsing next to the words "no
 * matches" is a mixed signal, and this is read at a glance. --on is added by
 * the server when the board has something, and by live-matches.js when a match
 * starts while the page is open.
 */
.live-panel {
  --lp-accent: #7b8494;
  --lp-accent-soft: rgba(123, 132, 148, 0.16);
  --lp-accent-line: rgba(123, 132, 148, 0.34);
  /* .live-dot reads this; it is normally declared by .live-board. */
  --live-red: #7b8494;

  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.live-panel--on {
  --lp-accent: #ff3b30;
  --lp-accent-soft: rgba(255, 59, 48, 0.2);
  --lp-accent-line: rgba(255, 59, 48, 0.42);
  --live-red: #ff3b30;
}

/* The pulse is what says "now", so it only runs when something is. */
.live-panel .live-dot {
  width: 8px;
  height: 8px;
  animation: none;
  box-shadow: none;
}

.live-panel--on .live-dot {
  animation: live-pulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .live-panel--on .live-dot { animation: none; }
}

.live-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.live-panel__eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--lp-accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.live-panel__count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.live-panel__all {
  color: #ef5c23;
  text-decoration: none;
}

.live-panel__all:hover {
  text-decoration: underline;
}

.live-panel__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-panel__row {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 14px;
  background: #0d1119;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

/* A match in progress with every feed dark stays in the list and stays plain:
   it is real, but there is nothing behind it to watch. */
.live-panel__row--on {
  border-color: var(--lp-accent-line);
}

.live-panel__row--on::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 160% at 96% 50%, var(--lp-accent-soft), transparent 64%);
}

.live-panel__row--on::after {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 14%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--lp-accent);
}

.live-panel__link {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  text-decoration: none;
  color: inherit;
}

/* The frame. Small, but still 16:9 and still the stream's own thumbnail where
   Kick gives one -- the point of the row is that you can see the table. */
.live-panel__frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 20% 0%, rgba(239, 92, 35, 0.26), transparent 60%),
    linear-gradient(145deg, #1b2130 0%, #0b0e14 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.live-panel__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-panel__pill {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #ff3b30;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.live-panel__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.live-panel__names {
  display: block;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-panel__vs {
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 2px;
}

.live-panel__meta {
  display: block;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-panel__rank {
  color: #ef5c23;
  font-weight: 800;
}

.live-panel__unranked {
  font-style: italic;
}

.live-panel__dot {
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.28);
}

.live-panel__score {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.live-panel__empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border-radius: 16px;
  background: #0d1119;
  border: 1px dashed rgba(255, 255, 255, 0.14);
}

.live-panel__empty strong {
  color: #ffffff;
  font-size: 0.96rem;
}

.live-panel__empty span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.84rem;
  line-height: 1.45;
}

@media (max-width: 420px) {
  .live-panel__link {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 10px;
  }
}

/* ---------------------------------------------------------------- header -- */

.live-board__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.live-board__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.live-board__count {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--live-text-soft);
}

.live-board__all {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--live-orange);
  text-decoration: none;
  white-space: nowrap;
}

.live-board__all:hover {
  text-decoration: underline;
}

/*
 * The blinking dot, shared by the heading, every card badge, and the home
 * page's live banner -- which lives in learn-banner.php and sets --live-red
 * itself, since that variable is normally declared by .live-board below.
 *
 * A slow opacity pulse rather than a hard on/off: at this size a hard blink
 * reads as a rendering fault, and it is on screen for as long as the page is.
 */
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live-red);
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.55);
  animation: live-pulse 1.6s ease-in-out infinite;
  flex: none;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5); }
  50%      { opacity: 0.45; box-shadow: 0 0 0 6px rgba(255, 59, 48, 0); }
}

/* Respect a reader who has asked for less motion: the dot stays, it stops
   moving. It is still red, and the word LIVE is still next to it. */
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; opacity: 1; }
}

/* ------------------------------------------------------------------ grid -- */

.live-board__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.live-board--compact .live-board__grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.live-board__empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 22px;
  border: 1px dashed var(--live-border);
  border-radius: 14px;
  background: var(--live-panel);
  color: var(--live-text-soft);
}

.live-board__empty strong {
  color: var(--live-text);
  font-size: 1.05rem;
}

.live-board__empty a {
  color: var(--live-orange);
}

/* ------------------------------------------------------------------ card -- */

.live-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--live-border);
  border-radius: 14px;
  background: var(--live-panel);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.live-card:hover,
.live-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(239, 92, 35, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.live-card__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(120% 100% at 20% 0%, rgba(239, 92, 35, 0.28), transparent 60%),
    linear-gradient(145deg, #1b2130 0%, #0b0e14 100%);
  overflow: hidden;
}

.live-card__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Above the fallback, so a thumbnail that loads simply covers it. If the
     image 404s it removes itself and the fallback is what was there all
     along. */
  z-index: 1;
}

/* The frame with no picture: the matchup, centred and set large. */
.live-card__frame-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.live-card__frame-fallback em {
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* Darkens the bottom of a real thumbnail so the overlaid chips stay legible
   whatever the stream happens to be showing. */
.live-card__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0) 45%);
  pointer-events: none;
}

.live-card__badge,
.live-card__viewers,
.live-card__elapsed {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.live-card__badge {
  top: 10px;
  left: 10px;
  background: var(--live-red);
  color: #fff;
}

.live-card__badge--dark {
  background: rgba(0, 0, 0, 0.68);
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--live-border);
}

/* The badge carries its own dot on a red field, so the pulse there is a
   brightness change rather than the ring used in the heading. */
.live-card__badge .live-dot {
  background: #fff;
  box-shadow: none;
  animation: live-blink 1.4s steps(1, end) infinite;
}

@keyframes live-blink {
  0%, 60%  { opacity: 1; }
  61%, 100% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .live-card__badge .live-dot { animation: none; opacity: 1; }
}

.live-card__viewers {
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.live-card__elapsed {
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.68);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Play triangle, drawn with borders so the card needs no image asset. */
.live-card__play {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.75);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.live-card__play::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}

.live-card:hover .live-card__play,
.live-card:focus-visible .live-card__play {
  opacity: 1;
}

/* ------------------------------------------------------------ card body -- */

.live-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-card__vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.live-card__vs-sep {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--live-text-soft);
}

.live-card__side {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* The right-hand side mirrors, so the two names read outward from the "vs". */
.live-card__side:last-child {
  align-items: flex-end;
  text-align: right;
}

.live-card__name {
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.live-card__meta {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--live-text-soft);
  white-space: nowrap;
}

.live-card__rank {
  color: var(--live-orange);
  font-weight: 700;
}

.live-card__unranked {
  font-style: italic;
}

.live-card__score {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.live-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--live-border);
  font-size: 0.74rem;
  color: var(--live-text-soft);
}

.live-card__ladder {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-card__caster {
  color: var(--live-orange);
  font-weight: 600;
}

/* --------------------------------------------------------------- narrow -- */

@media (max-width: 560px) {
  .live-board {
    padding: 22px 14px 30px;
  }

  .live-board__grid,
  .live-board--compact .live-board__grid {
    grid-template-columns: 1fr;
  }

  .live-board__title {
    font-size: 1.25rem;
  }
}
