/**
 * FootballCast — табло матча (fc-tablo v2)
 * Единый компонент: шапка, счёт, команды, таймлайн.
 */

.fc-match-page .fc-tablo {
  --fc-tablo-pad-y: 0.75rem;
  --fc-tablo-pad-inline: 1.15rem;
  --fc-tablo-chrome: 2.35rem; /* место под абсолютную шапку */
  --fc-tablo-chrome-top: var(--fc-tablo-chrome);
  /* Снизу почти без поля — иначе тёмный низ карточки выглядит как зазор до вкладок */
  --fc-tablo-chrome-bottom: 0.2rem;
  --fc-tablo-gap: 0;
  --fc-tablo-board-gap: clamp(0.45rem, 1.8vw, 0.85rem);
  --fc-tablo-logo: 60px;

  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding:
    calc(var(--fc-tablo-pad-y) + var(--fc-tablo-chrome-top))
    var(--fc-tablo-pad-inline)
    calc(var(--fc-tablo-pad-y) + var(--fc-tablo-chrome-bottom)) !important;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(circle at top left, rgba(22, 163, 74, 0.22) 0%, transparent 32%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.1) 0%, transparent 28%),
    linear-gradient(160deg, #10192a 0%, #121f35 42%, #091321 100%);
  box-shadow:
    0 22px 48px rgba(2, 6, 23, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #fff;
  min-height: 11rem;
  overflow: hidden;
}

.fc-match-page .fc-tablo.fc-tablo--with-timeline {
  --fc-tablo-chrome-bottom: 0.85rem; /* только полоска 0'——90' */
  min-height: 11.5rem;
}

/* ---------- Шапка: лига | дата + избранное ---------- */
.fc-match-page .fc-tablo__head {
  position: absolute;
  top: var(--fc-tablo-pad-y);
  left: var(--fc-tablo-pad-inline);
  right: var(--fc-tablo-pad-inline);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 0.85rem;
  pointer-events: none;
}

.fc-match-page .fc-tablo__head a,
.fc-match-page .fc-tablo__head button {
  pointer-events: auto;
}

.fc-match-page .fc-tablo__league {
  flex: 1 1 auto;
  min-width: 0;
}

.fc-match-page .fc-tablo__league-link,
.fc-match-page .fc-tablo__league-muted {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  min-height: 32px;
  padding: 0.28rem 0.62rem 0.28rem 0.42rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
}

.fc-match-page .fc-tablo__league-link:hover {
  color: #fff;
  border-color: rgba(74, 222, 128, 0.28);
}

.fc-match-page .fc-tablo__league-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.95);
  flex-shrink: 0;
}

.fc-match-page .fc-tablo__league-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-match-page .fc-tablo__meta {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  flex-shrink: 0;
}

.fc-match-page .fc-tablo__info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  text-align: right;
}

.fc-match-page .fc-tablo__datetime {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem 0.35rem;
  padding: 0.28rem 0.52rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(9, 16, 28, 0.56), rgba(15, 23, 36, 0.82));
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.22;
  color: rgba(255, 255, 255, 0.92);
}

.fc-match-page .fc-tablo__datetime-ico {
  opacity: 0.75;
  font-size: 0.7rem;
}

.fc-match-page .fc-tablo__stage {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.72);
}

.fc-match-page .fc-tablo__venue {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  max-width: 14rem;
  font-size: 0.64rem;
  line-height: 1.2;
  color: rgba(226, 232, 240, 0.68);
}

.fc-match-page .fc-tablo__favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 8px 18px rgba(2, 6, 23, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.fc-match-page .fc-tablo__favorite:hover {
  border-color: rgba(74, 222, 128, 0.28);
  color: #fff;
}

.fc-match-page .fc-tablo__favorite.fc-fixture-favorite-btn--active {
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.22), rgba(250, 204, 21, 0.08));
  color: #fde68a;
  box-shadow:
    0 8px 18px rgba(2, 6, 23, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.fc-match-page .fc-tablo__favorite .tab-icon {
  font-size: 0.88rem;
}

/* ---------- Основная сетка: К1 | счёт | К2 ---------- */
.fc-match-page .fc-tablo__board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--fc-tablo-board-gap);
  row-gap: 0.35rem;
  padding-block: 0.15rem;
  margin: 0;
  position: relative;
  z-index: 1;
}

.fc-match-page .fc-tablo__team {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  color: inherit;
  text-decoration: none;
}

.fc-match-page .fc-tablo__team:hover {
  color: #fff;
}

.fc-match-page .fc-tablo__team--home {
  justify-self: end;
  align-items: flex-end;
  text-align: right;
}

.fc-match-page .fc-tablo__team--away {
  justify-self: start;
  align-items: flex-start;
  text-align: left;
}

.fc-match-page .fc-tablo__logo {
  width: var(--fc-tablo-logo);
  height: var(--fc-tablo-logo);
  object-fit: contain;
  border-radius: 12px;
  padding: 0.18rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22);
}

.fc-match-page .fc-tablo__name {
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.fc-match-page .fc-tablo__country {
  font-size: 0.68rem;
  line-height: 1.2;
  color: rgba(226, 232, 240, 0.65);
}

/* ---------- Центр: счёт и статус ---------- */
.fc-match-page .fc-tablo__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-width: clamp(4.8rem, 12vw, 6.2rem);
  padding-inline: 0.15rem;
  text-align: center;
}

.fc-match-page .fc-tablo__score {
  font-size: clamp(1.65rem, 3.8vw, 2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 0 10px 28px rgba(15, 23, 42, 0.4);
}

.fc-match-page .fc-tablo__breakdown {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(9, 16, 28, 0.3);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 0.12rem;
}

.fc-match-page .fc-tablo__breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.fc-match-page .fc-tablo__status-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.fc-match-page .fc-tablo__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 3.5rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.fc-match-page .fc-tablo__status--live {
  animation: fc-tablo-pulse 1.6s ease-in-out infinite;
}

@keyframes fc-tablo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}

.fc-match-page .fc-tablo__status-note {
  font-size: 0.68rem;
  line-height: 1.2;
  color: rgba(226, 232, 240, 0.62);
  max-width: 9rem;
}

.fc-match-page .fc-tablo__status-wrap:has(.fc-finished-badge) .fc-tablo__status-note {
  display: none;
}

/* Совместимость с live-поллингом (выше public-redesign) */
.fc-redesign-body .fc-rdx-fixture.fc-match-page .fc-tablo .score-compact,
.fc-match-page .fc-tablo .score-compact {
  font-size: clamp(1.65rem, 3.8vw, 2rem) !important;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.fc-redesign-body .fc-rdx-fixture.fc-match-page .fc-tablo .compact-status,
.fc-match-page .fc-tablo .compact-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 3.5rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.fc-match-page .fc-tablo .compact-status.bg-success {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.85), rgba(22, 163, 74, 0.92)) !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
  color: #fff !important;
}

/* ---------- Таймлайн лайва (внизу карточки, не сдвигает счёт) ---------- */
.fc-match-page .fc-tablo .fc-match-hero-timeline-wrap {
  margin: 0 !important;
}

.fc-match-page .fc-tablo__timeline {
  position: absolute;
  left: var(--fc-tablo-pad-inline);
  right: var(--fc-tablo-pad-inline);
  bottom: var(--fc-tablo-pad-y);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: auto;
  padding: 0;
  margin: 0;
  z-index: 3;
  flex-shrink: 0;
  pointer-events: none;
}

.fc-match-page .fc-tablo__timeline-edge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.78);
}

.fc-match-page .fc-tablo .fc-match-timeline {
  height: 14px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 2px;
}

.fc-match-page .fc-tablo .fc-match-timeline__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.fc-match-page .fc-tablo .fc-match-timeline__fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: var(--fc-tl-pct, 0%);
  max-width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.72));
  pointer-events: none;
  transition: width 0.35s ease-out;
}

.fc-match-page .fc-tablo .fc-match-timeline__dot {
  position: absolute;
  top: 50%;
  left: clamp(5px, var(--fc-tl-pct, 0%), calc(100% - 5px));
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 2px rgba(22, 77, 50, 0.95),
    0 2px 10px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  transition: left 0.35s ease-out;
}

.fc-match-page .fc-tablo .fc-match-timeline--live .fc-match-timeline__dot {
  animation: fc-match-timeline-pulse 1.6s ease-in-out infinite;
}

@keyframes fc-match-timeline-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(22, 77, 50, 0.95),
      0 2px 10px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(22, 77, 50, 0.95),
      0 0 0 6px rgba(255, 255, 255, 0.18),
      0 2px 10px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- Мобилка: компактная сетка К1 | счёт | К2 ---------- */
@media (max-width: 767.98px) {
  .fc-match-page .fc-tablo {
    /* Сверху: лига + дата/стадия; снизу: только таймлайн — иначе низ «пустой», верх вплотную */
    --fc-tablo-pad-y: 0.9rem;
    --fc-tablo-chrome: 2.55rem;
    --fc-tablo-chrome-top: 4.55rem;
    --fc-tablo-chrome-bottom: 1.35rem;
    min-height: 0;
  }

  .fc-match-page .fc-tablo.fc-tablo--with-timeline {
    --fc-tablo-chrome-top: 4.55rem;
    --fc-tablo-chrome-bottom: 1.35rem;
    min-height: 0;
  }

  .fc-match-page .fc-tablo:not(.fc-tablo--with-timeline) {
    --fc-tablo-chrome-bottom: 0.35rem;
  }

  .fc-match-page .fc-tablo__info {
    display: none !important;
  }

  .fc-match-page .fc-tablo__head {
    align-items: center;
    gap: 0.45rem 0.55rem;
  }

  .fc-match-page .fc-tablo__league-link,
  .fc-match-page .fc-tablo__league-muted {
    min-height: 30px;
    padding: 0.22rem 0.5rem 0.22rem 0.38rem;
    font-size: 0.7rem;
  }

  .fc-match-page .fc-tablo__mobile-meta {
    position: absolute;
    top: calc(var(--fc-tablo-pad-y) + 2.45rem);
    left: var(--fc-tablo-pad-inline);
    right: var(--fc-tablo-pad-inline);
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem 0.45rem;
    margin: 0;
    padding: 0;
    font-size: 0.68rem;
    color: rgba(226, 232, 240, 0.68);
  }

  .fc-match-page .fc-tablo__mobile-stage {
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.78);
  }

  .fc-match-page .fc-tablo__board {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
    column-gap: 0.4rem;
    row-gap: 0;
    padding-block: 0.15rem;
  }

  .fc-match-page .fc-tablo__team--home {
    order: 0;
    justify-self: stretch;
    align-items: flex-end;
    text-align: right;
  }

  .fc-match-page .fc-tablo__center {
    order: 0;
    min-width: 4.1rem;
    padding-inline: 0.05rem;
  }

  .fc-match-page .fc-tablo__team--away {
    order: 0;
    justify-self: stretch;
    align-items: flex-start;
    text-align: left;
  }

  .fc-match-page .fc-tablo__logo {
    width: 46px;
    height: 46px;
    padding: 0.14rem;
    border-radius: 11px;
  }

  .fc-match-page .fc-tablo__name {
    font-size: 0.76rem;
    line-height: 1.15;
    margin-top: 0.12rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
  }

  .fc-match-page .fc-tablo__country {
    display: none;
  }

  .fc-match-page .fc-tablo__score,
  .fc-match-page .fc-tablo .score-compact {
    font-size: clamp(1.45rem, 7.5vw, 1.75rem) !important;
  }

  .fc-match-page .fc-tablo__status {
    min-width: 2.8rem;
    padding: 0.18rem 0.38rem;
    font-size: 0.66rem;
  }

  .fc-match-page .fc-tablo__breakdown {
    padding: 0.28rem 0.38rem;
    font-size: 0.66rem;
  }
}

@media (max-width: 575.98px) {
  .fc-match-page .fc-tablo {
    --fc-tablo-pad-y: 0.85rem;
    --fc-tablo-pad-inline: 0.78rem;
    --fc-tablo-chrome-top: 4.65rem;
    --fc-tablo-chrome-bottom: 1.3rem;
    border-radius: 16px;
  }

  .fc-match-page .fc-tablo.fc-tablo--with-timeline {
    --fc-tablo-chrome-top: 4.65rem;
    --fc-tablo-chrome-bottom: 1.3rem;
  }

  .fc-match-page .fc-tablo:not(.fc-tablo--with-timeline) {
    --fc-tablo-chrome-bottom: 0.3rem;
  }

  .fc-match-page .fc-tablo__mobile-meta {
    top: calc(var(--fc-tablo-pad-y) + 2.4rem);
  }

  .fc-match-page .fc-tablo__league-name {
    max-width: 11.5rem;
  }

  .fc-match-page .fc-tablo__favorite {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .fc-match-page .fc-tablo {
    --fc-tablo-pad-y: 0.95rem;
    --fc-tablo-pad-inline: 0.88rem;
    --fc-tablo-chrome-top: 4.45rem;
    --fc-tablo-chrome-bottom: 1.4rem;
  }

  .fc-match-page .fc-tablo.fc-tablo--with-timeline {
    --fc-tablo-chrome-top: 4.45rem;
    --fc-tablo-chrome-bottom: 1.4rem;
  }

  .fc-match-page .fc-tablo:not(.fc-tablo--with-timeline) {
    --fc-tablo-chrome-bottom: 0.35rem;
  }

  .fc-match-page .fc-tablo__logo {
    width: 50px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fc-match-page .fc-tablo__status--live,
  .fc-match-page .fc-tablo .fc-match-timeline--live .fc-match-timeline__dot {
    animation: none;
  }

  .fc-match-page .fc-tablo .fc-match-timeline__fill,
  .fc-match-page .fc-tablo .fc-match-timeline__dot {
    transition: none;
  }
}
