/* Спорт: live results table (inc/livescores.php, assets/js/livescores.js). Phone first. */

.ed-scores {
  scroll-margin-top: calc(var(--ed-sticky-top, 64px) + 16px); /* «Сите резултати» in the masthead's strip */
  margin: var(--ed-s6) 0 var(--ed-s8);
  padding-top: var(--ed-s3);
  border-top: 3px solid var(--sd-c);
  font-family: var(--ed-sans);
  color: var(--ed-ink);
}

/* Head: «Резултати», the live dot (the only red), the update time, the stale note */
.ed-scores__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--ed-s3);
  row-gap: var(--ed-s1);
  margin-bottom: var(--ed-s3);
}
.ed-scores__title {
  margin: 0 auto 0 0;
  font-family: var(--ed-head);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.005em;
}
.ed-scores__on {
  font-size: var(--ed-fs-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ed-red);
}
.ed-scores__on[hidden], .ed-scores__stale[hidden] { display: none; }
.ed-scores__upd, .ed-scores__stale {
  font-size: 0.75rem;
  color: var(--ed-ink-4);
  font-variant-numeric: tabular-nums;
}
.ed-scores__stale { color: var(--ed-ink-3); font-style: italic; }

/* Filter chips: shown only when the script runs (the class is set before first paint) */
.ed-scores__filters { display: none; }
.ed-scores-js .ed-scores__filters {
  display: flex;
  flex-direction: column;
  gap: var(--ed-s2);
  margin-bottom: var(--ed-s3);
}
.ed-scores__chips {
  display: flex;
  gap: var(--ed-s2);
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--ed-gutter));
  padding: 0 var(--ed-gutter);
}
.ed-scores__chips::-webkit-scrollbar { display: none; }
.ed-scores__chips .ed-chip { min-height: 36px; flex: none; cursor: pointer; background: var(--ed-bg); }
.ed-scores__chips .ed-chip[aria-pressed="true"] { border-color: var(--ed-ink); background: var(--ed-ink); color: #fff; }
.ed-scores__chips .ed-chip:disabled { color: var(--ed-ink-4); border-color: var(--ed-line); cursor: default; }
.ed-scores__chips .ed-chip:focus-visible { outline: 2px solid var(--sd-c-text); outline-offset: 2px; }
/* The count of each state; a chip with nothing to add (none, or all of them) is left out. */
.ed-chip__n { margin-left: 2px; font-weight: 500; font-variant-numeric: tabular-nums; opacity: 0.7; }
.ed-scores__chips .ed-chip[hidden],
.ed-scores__chips[hidden],
.ed-scores-js .ed-scores__filters[hidden] { display: none; }

/* Competitions: ruled groups */
.ed-scores__comps { display: grid; gap: var(--ed-s5); }
.ed-scores__c[hidden] { display: none; }
.ed-scores__k {
  margin: 0;
  padding-bottom: var(--ed-s2);
  font-size: var(--ed-fs-label);
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--sd-c-text);
}
.ed-scores__k span { color: var(--ed-ink-4); font-weight: 600; }
.ed-scores__ms { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--sd-line, var(--ed-line)); }

/* A row: status | home | score | away | toggle */
.ed-scores__m { border-top: 1px solid var(--sd-line, var(--ed-line)); }
.ed-scores__m[hidden] { display: none; }
.ed-scores__row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 50px minmax(0, 1fr) 40px;
  align-items: center;
  column-gap: 6px;
  min-height: 48px;
  font-size: 0.875rem;
  line-height: 1.25;
}
.ed-scores--compact .ed-scores__row { grid-template-columns: 46px minmax(0, 1fr) 50px minmax(0, 1fr); }
.ed-scores__m.is-on .ed-scores__row::before {
  content: "";
  position: absolute;
  left: -8px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--sd-c);
}

.ed-scores__st {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ed-ink-3);
  font-variant-numeric: tabular-nums;
}
.ed-scores__st abbr { text-decoration: none; }
.ed-scores__st.is-live { color: var(--sd-c-text); font-weight: 700; }
.ed-scores__st.is-off { color: var(--ed-ink-4); }
.ed-scores__st.is-ns time { color: var(--ed-ink-2); }
.ed-scores__day { font-size: 0.6875rem; font-weight: 500; color: var(--ed-ink-4); }

.ed-scores__t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ed-scores__t--home { justify-content: flex-end; text-align: right; }
.ed-scores__nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ed-scores__sh { display: none; font-weight: 600; letter-spacing: 0.02em; }
.ed-scores__m.is-finished .ed-scores__nm { color: var(--ed-ink-2); }
.ed-scores__m.is-postponed .ed-scores__nm { color: var(--ed-ink-3); }

.ed-scores__logo {
  flex: none;
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.ed-scores__logo--none { display: block; border-radius: 50%; background: var(--ed-bg-3); }

.ed-scores__sc {
  display: flex;
  justify-content: center;
  gap: 3px;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ed-ink);
}
.ed-scores__sc b { display: inline-block; min-width: 0.7em; text-align: center; font-weight: inherit; }
.ed-scores__sc i { font-style: normal; color: var(--ed-ink-4); font-weight: 500; }
.ed-scores__sc.is-none { color: var(--ed-ink-4); font-weight: 500; }
.ed-scores__m.is-on .ed-scores__sc { color: var(--sd-c-text); }
.ed-scores__m.is-finished .ed-scores__sc { color: var(--ed-ink-2); }

.ed-scores__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ed-ink-3);
  cursor: pointer;
  border-radius: var(--ed-radius);
}
.ed-scores__more[hidden] { display: inline-flex; visibility: hidden; }
.ed-scores__more svg { transition: transform 0.2s var(--ed-motion); }
.ed-scores__more[aria-expanded="true"] { color: var(--sd-c-text); }
.ed-scores__more[aria-expanded="true"] svg { transform: rotate(180deg); }
.ed-scores__more:hover { color: var(--ed-ink); }
.ed-scores__more:focus-visible { outline: 2px solid var(--sd-c-text); outline-offset: -2px; }

/* Details: venue, statistics with comparison bars, events timeline */
.ed-scores__det {
  margin: 0 0 var(--ed-s3);
  padding: var(--ed-s3) var(--ed-s4) var(--ed-s4);
  background: var(--sd-c-wash, var(--ed-bg-2));
  border-radius: var(--ed-radius);
}
.ed-scores__det[hidden] { display: none; }
.ed-scores__venue { margin: 0 0 var(--ed-s3); font-size: 0.75rem; color: var(--ed-ink-4); }
.ed-scores__stats { display: grid; gap: var(--ed-s3); }
.ed-scores__s {
  display: grid;
  grid-template-columns: 3ch 1fr 3ch;
  align-items: baseline;
  row-gap: 4px;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.ed-scores__sv { font-weight: 700; }
.ed-scores__s .ed-scores__sv:last-of-type { text-align: right; }
.ed-scores__sl { text-align: center; color: var(--ed-ink-3); font-size: 0.75rem; }
.ed-scores__bar { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ed-scores__bar i { display: flex; height: 4px; background: var(--ed-bg-3); border-radius: 2px; overflow: hidden; }
.ed-scores__bar i:first-child { justify-content: flex-end; }
.ed-scores__bar b { display: block; height: 100%; background: var(--ed-line-2); border-radius: 2px; }
.ed-scores__bar b.is-lead { background: var(--sd-c); }

.ed-scores__ev { margin: var(--ed-s4) 0 0; padding: var(--ed-s3) 0 0; list-style: none; border-top: 1px solid var(--sd-line, var(--ed-line)); display: grid; gap: 6px; }
.ed-scores__stats + .ed-scores__ev, .ed-scores__venue + .ed-scores__ev { margin-top: var(--ed-s3); }
.ed-scores__venue + .ed-scores__ev { border-top: 0; padding-top: 0; }
.ed-scores__e { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; line-height: 1.3; }
.ed-scores__e--away { flex-direction: row-reverse; text-align: right; }
.ed-scores__em { flex: none; min-width: 3.2em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ed-ink-3); }
.ed-scores__e--away .ed-scores__em { text-align: right; }
.ed-scores__ei { flex: none; color: var(--ed-ink); }
.ed-scores__e.is-goal .ed-scores__ei, .ed-scores__e.is-pen .ed-scores__ei { color: var(--sd-c-text); }
.ed-scores__e.is-own .ed-scores__ei { color: var(--ed-ink-4); }
.ed-scores__ep { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-scores__ed { color: var(--ed-ink-4); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* «Прикажи ги сите» and the empty-filter note */
.ed-scores__all { display: none; }
.ed-scores-js .ed-scores__all { display: inline-flex; margin-top: var(--ed-s4); min-height: 44px; }
.ed-scores-js .ed-scores__all[hidden] { display: none; }
.ed-scores__n { color: var(--ed-ink-4); font-weight: 500; margin-left: 4px; }
.ed-scores-js .ed-scores:not(.is-all) .is-extra { display: none; }
/* Phones open with the three most relevant matches (.is-wide rows join from 740px). */
@media (max-width: 739.98px) {
  .ed-scores-js .ed-scores:not(.is-all) .is-wide { display: none; }
}
@media (min-width: 740px) {
  .ed-scores-js .ed-scores__all.is-narrow { display: none; }
}
.ed-scores__none { margin: var(--ed-s3) 0 0; font-size: 0.875rem; color: var(--ed-ink-3); }
.ed-scores__none[hidden] { display: none; }

/* A changed score flashes once */
.ed-scores__sc.is-flash b { animation: ed-scores-flash 0.9s var(--ed-motion) 1; }
@keyframes ed-scores-flash {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.35); opacity: 0.55; }
  100% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ed-scores__sc.is-flash b { animation: none; }
  .ed-scores__more svg { transition: none; }
}

/* Phones: a long club name takes a second line instead of being cut to a stub; the crest steps down to
   20px to give the name the room. */
@media (max-width: 739.98px) {
  .ed-scores__nm {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }
  .ed-scores__row { padding-block: 4px; }
  .ed-scores__logo { width: 20px; height: 20px; }
  .ed-scores__t { gap: 5px; }
}

/* The narrowest phones: the feed's short codes stand in for long names */
@media (max-width: 339.98px) {
  .ed-scores__t.has-short .ed-scores__nm {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .ed-scores__t.has-short .ed-scores__sh { display: inline; }
  .ed-scores__row { grid-template-columns: 42px minmax(0, 1fr) 46px minmax(0, 1fr) 40px; }
}

@media (min-width: 740px) {
  .ed-scores__chips { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; }
  .ed-scores-js .ed-scores__filters { flex-direction: row; flex-wrap: wrap; justify-content: space-between; }
  .ed-scores__row { grid-template-columns: 56px minmax(0, 1fr) 60px minmax(0, 1fr) 44px; column-gap: 10px; font-size: 0.9375rem; }
  .ed-scores--compact .ed-scores__row { grid-template-columns: 56px minmax(0, 1fr) 60px minmax(0, 1fr); }
  .ed-scores__m.is-on .ed-scores__row::before { left: -12px; }
  .ed-scores__det { padding: var(--ed-s4) var(--ed-s5) var(--ed-s5); }
}

/* Desktop: the rows of every competition fill two columns side by side under its own full-width label,
   so a league of seven next to a league of one never leaves a hole (the label always sits over its rows). */
@media (min-width: 1024px) {
  .ed-scores:not(.ed-scores--compact) .ed-scores__ms {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: calc(2 * var(--ed-col-pad));
    align-items: start;
  }
}
