/* Shared SSR livescores boxes. Keep every rule inside the livescores-box namespace. */
.livescores-box,
.livescores-box *,
.livescores-box *::before,
.livescores-box *::after {
  box-sizing: border-box;
}

.livescores-box {
  --livescores-accent: #254892;
  --livescores-live: #d71920;
  --livescores-border: #e1e5eb;
  --livescores-muted: #687386;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 20px;
  overflow: hidden;
  color: #1c2738;
  background: #fff;
  border: 1px solid var(--livescores-border);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.livescores-box__header {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f6f8fb;
  border-bottom: 1px solid var(--livescores-border);
}

.livescores-box__heading {
  min-width: 0;
  flex: 1 1 auto;
}

.livescores-box__title,
.livescores-box__subtitle,
.livescores-box__group-title {
  margin: 0;
  color: #172033;
  font-family: inherit;
  line-height: 1.3;
}

.livescores-box__title {
  font-size: 18px;
  font-weight: 700;
}

.livescores-box__subtitle {
  padding: 12px 16px 8px;
  font-size: 15px;
}

.livescores-box__group-title {
  padding: 10px 12px;
  font-size: 14px;
  background: #f6f8fb;
}

.livescores-box__league,
.livescores-box__stage-name {
  min-width: 0;
  color: var(--livescores-muted);
  font-size: 13px;
  text-decoration: none;
}

.livescores-box a.livescores-box__league:hover,
.livescores-box a.livescores-box__team-link:hover,
.livescores-box a.livescores-box__match-link:hover .livescores-box__team-name {
  color: var(--livescores-accent);
}

.livescores-box__league-logo,
.livescores-box__team-logo {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
}

.livescores-box__league-logo {
  width: 36px;
  height: 36px;
}

.livescores-box__tabs {
  display: flex;
  max-width: 100%;
  gap: 4px;
  padding: 8px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--livescores-border);
  scrollbar-width: thin;
}

.livescores-box__tab {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  color: #344054;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.livescores-box__tab:hover,
.livescores-box__tab:focus-visible,
.livescores-box__tab--active {
  color: #fff;
  background: var(--livescores-accent);
  outline: none;
}

.livescores-box__body {
  position: relative;
  min-width: 0;
}

.livescores-box--loading .livescores-box__body {
  min-height: 96px;
  opacity: .65;
  pointer-events: none;
}

.livescores-box--loading .livescores-box__body::after {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd3df;
  border-top-color: var(--livescores-accent);
  border-radius: 50%;
  content: "";
  animation: livescores-box-spin .7s linear infinite;
}

@keyframes livescores-box-spin {
  to { transform: rotate(360deg); }
}

.livescores-box__state {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  color: var(--livescores-muted);
  text-align: center;
}

.livescores-box__state--error {
  color: #9b2c2c;
  background: #fff8f8;
}

.livescores-box__match {
  min-height: 76px;
  border-bottom: 1px solid var(--livescores-border);
}

.livescores-box__match:last-child {
  border-bottom: 0;
}

.livescores-box__match-link {
  display: grid;
  min-width: 0;
  min-height: 76px;
  grid-template-columns: 80px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: inherit;
  text-decoration: none;
}

.livescores-box__match-time,
.livescores-box__match-time time {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.livescores-box__match-date,
.livescores-box__match-status {
  color: var(--livescores-muted);
  font-size: 12px;
}

.livescores-box__match-hour {
  font-weight: 700;
}

.livescores-box__match--live {
  box-shadow: inset 3px 0 0 var(--livescores-live);
}

.livescores-box__match--live .livescores-box__match-status {
  color: var(--livescores-live);
  font-weight: 700;
}

.livescores-box__match-teams {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.livescores-box__team,
.livescores-box__team-link {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.livescores-box__team-logo {
  width: 28px;
  height: 28px;
}

.livescores-box__team-name,
.livescores-box__team-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.livescores-box__match-score {
  justify-self: end;
  color: #172033;
  font-size: 18px;
  white-space: nowrap;
}

.livescores-box__standing-group + .livescores-box__standing-group {
  border-top: 1px solid var(--livescores-border);
}

.livescores-box__table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.livescores-box__table {
  width: 100%;
  min-width: 540px;
  border-spacing: 0;
  border-collapse: collapse;
  table-layout: auto;
}

.livescores-box__table th,
.livescores-box__table td {
  height: 44px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--livescores-border);
  text-align: center;
  white-space: nowrap;
}

.livescores-box__table thead th {
  color: var(--livescores-muted);
  background: #fbfcfd;
  font-size: 12px;
  font-weight: 600;
}

.livescores-box__table tbody th {
  min-width: 180px;
  text-align: left;
  font-weight: 600;
}

.livescores-box__table .livescores-box__team-logo {
  width: 24px;
  height: 24px;
}

/* Match the compact legacy standings iframe. */
.livescores-box--standings {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.livescores-box--standings > .livescores-box__header,
.livescores-box--standings .livescores-box__subtitle,
.livescores-box--standings .livescores-box__table > :is(thead, tbody) > tr > :is(th, td):nth-child(n+4):nth-child(-n+6) {
  display: none;
}

.livescores-box--standings .livescores-box__standing-group {
  position: relative;
}

.livescores-box--standings .livescores-box__group-title {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  display: flex;
  width: 70%;
  height: 34px;
  align-items: center;
  padding: 4px 10px;
  color: #fff;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

.livescores-box--standings .livescores-box__table-wrap {
  overflow-x: hidden;
}

.livescores-box--standings .livescores-box__table {
  min-width: 0;
  table-layout: fixed;
  border: 1px solid #ebebeb;
}

.livescores-box--standings .livescores-box__table > thead > tr > th {
  height: 34px;
  padding: 4px 5px;
  color: #fff;
  background: #254892;
  border: 0;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
}

.livescores-box--standings .livescores-box__table > thead > tr > th:nth-child(-n+2) {
  color: transparent;
}

.livescores-box--standings .livescores-box__table > :is(thead, tbody) > tr > :first-child {
  width: 38px;
}

.livescores-box--standings .livescores-box__table > :is(thead, tbody) > tr > :nth-child(2) {
  width: calc(70% - 38px);
}

.livescores-box--standings .livescores-box__table > :is(thead, tbody) > tr > :is(:nth-child(3), :nth-child(7), :nth-child(8)) {
  width: 10%;
}

.livescores-box--standings .livescores-box__table > tbody > tr > * {
  min-width: 0;
  height: 34px;
  padding: 4px 5px;
  color: #000;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
  font-size: 14px;
}

.livescores-box--standings .livescores-box__table > tbody > tr:nth-child(even) > * {
  background: #f4f4f4;
}

.livescores-box--standings .livescores-box__table > tbody > tr:last-child > * {
  border-bottom: 0;
}

.livescores-box--standings .livescores-box__table .livescores-box__team-link {
  gap: 8px;
  color: #254892;
  font-size: 13px;
}

.livescores-box--standings .livescores-box__table .livescores-box__team-logo {
  width: 21px;
  height: 21px;
}

.livescores-box__teams {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  list-style: none;
  background: var(--livescores-border);
}

.livescores-box__teams-item {
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  background: #fff;
}

.livescores-box__teams-item .livescores-box__team-logo {
  width: 40px;
  height: 40px;
}

.livescores-box__event-summary,
.livescores-box__statistics {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 1px;
  background: var(--livescores-border);
}

.livescores-box__event-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.livescores-box__event-summary > div,
.livescores-box__statistics > div {
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
}

.livescores-box__event-summary dt,
.livescores-box__statistics dt {
  color: var(--livescores-muted);
  font-size: 12px;
}

.livescores-box__event-summary dd,
.livescores-box__statistics dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.livescores-box__event-panel,
.livescores-box__stage {
  min-width: 0;
}

.livescores-box__draw {
  display: flex;
  max-width: 100%;
  gap: 20px;
  padding: 12px 16px 18px;
  overflow-x: auto;
  background: #f6f8fb;
  scrollbar-width: thin;
}

.livescores-box__draw-round {
  display: flex;
  min-width: 220px;
  flex: 1 0 220px;
  flex-direction: column;
  margin: 0;
}

.livescores-box__draw-round-title {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 12px;
  padding: 7px 10px;
  color: #fff;
  background: var(--livescores-accent);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.livescores-box__draw-matches {
  display: flex;
  height: 100%;
  min-height: 100px;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
}

.livescores-box__draw-match {
  position: relative;
  padding: 4px 0 0;
  background: #fff;
  border: 1px solid var(--livescores-border);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

.livescores-box__draw-round:not(:last-child) .livescores-box__draw-match::after {
  position: absolute;
  top: 50%;
  right: -21px;
  width: 20px;
  border-top: 1px solid #aeb7c4;
  content: "";
}

.livescores-box__draw-team {
  display: grid;
  min-height: 32px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
}

.livescores-box__draw-team + .livescores-box__draw-team {
  border-top: 1px solid #eef1f5;
}

.livescores-box__draw-team--winner .livescores-box__draw-name,
.livescores-box__draw-team--winner .livescores-box__draw-scores {
  color: var(--livescores-accent);
  font-weight: 700;
}

.livescores-box__draw-logo {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.livescores-box__draw-name {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.livescores-box__draw-scores {
  display: flex;
  gap: 5px;
  color: #344054;
  font-size: 12px;
}

.livescores-box__draw-events {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding: 6px 9px;
  background: #fafbfc;
  border-top: 1px solid #eef1f5;
}

.livescores-box__draw-events a {
  color: var(--livescores-accent);
  font-size: 11px;
  text-decoration: none;
}

.livescores-box__draw-events a:hover,
.livescores-box__draw-events a:focus-visible {
  text-decoration: underline;
}

/* Panels remain readable without JavaScript; enhancement hides only inactive panels. */
.livescores-box--enhanced [data-livescores-panel][hidden],
.livescores-box--enhanced [data-livescores-filter-panel][hidden] {
  display: none !important;
}

.livescores-box__commentary,
.livescores-box__lineup ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.livescores-box__commentary-item {
  display: grid;
  grid-template-columns: 42px 86px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--livescores-border);
}

.livescores-box__commentary-item small,
.livescores-box__lineup-player small {
  color: var(--livescores-muted);
}

.livescores-box__lineups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 0 16px 16px;
}

.livescores-box__lineup {
  min-width: 0;
}

.livescores-box__lineup h4 {
  margin: 0;
  padding: 10px 0;
}

.livescores-box__lineup-player {
  padding: 8px 10px;
  border-bottom: 1px solid var(--livescores-border);
  overflow-wrap: anywhere;
}

.livescores-box__lineup-player > span {
  display: inline-block;
  width: 28px;
  color: var(--livescores-muted);
}

.livescores-box__statistics > div {
  display: grid;
  grid-template-columns: minmax(48px, 1fr) minmax(110px, 2fr) minmax(48px, 1fr);
  align-items: center;
  text-align: center;
}

.livescores-box__statistics dt {
  grid-column: 2;
  grid-row: 1;
}

.livescores-box__statistics dd:first-of-type {
  grid-column: 1;
  grid-row: 1;
}

.livescores-box__statistics dd:last-of-type {
  grid-column: 3;
  grid-row: 1;
}

@media (max-width: 600px) {
  .livescores-box {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    font-size: 13px;
  }

  .livescores-box__header {
    min-height: 56px;
    padding: 10px 12px;
  }

  .livescores-box__title {
    font-size: 16px;
  }

  .livescores-box__match-link {
    min-height: 82px;
    grid-template-columns: 54px minmax(0, 1fr) 50px;
    gap: 8px;
    padding: 9px 10px;
  }

  .livescores-box__match-date {
    display: none;
  }

  .livescores-box__match-score {
    font-size: 16px;
  }

  .livescores-box__teams {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .livescores-box__event-summary,
  .livescores-box__lineups {
    grid-template-columns: minmax(0, 1fr);
  }

  .livescores-box__commentary-item {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 9px 12px;
  }

  .livescores-box__commentary-item small {
    display: none;
  }

  .livescores-box__table {
    min-width: 500px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .livescores-box--loading .livescores-box__body::after {
    animation: none;
  }
}
