/* Список матчей: фильтр по составам, полоса формы и серии, вкладка «Видео»,
   график «Сезон по матчам», полоса трёх составов на главной.
   Все классы модуля — с префиксом ml-. Базовые классы трогаем только адресно. */

/* ---------- Цвета составов клуба ---------- */
.ml-lane--main, .ml-chip--main, .ml-badge--main, .ml-squad--main, .ml-focus__dot--main {
  --ml-c: var(--jupiter); --ml-ct: var(--jupiter); --ml-cb: rgba(242, 137, 74, .16); --ml-cl: rgba(242, 137, 74, .45);
}
.ml-lane--elder, .ml-chip--elder, .ml-badge--elder, .ml-squad--elder, .ml-focus__dot--elder {
  --ml-c: #4A86D0; --ml-ct: #9CC2F0; --ml-cb: rgba(74, 134, 208, .18); --ml-cl: rgba(74, 134, 208, .55);
}
.ml-lane--younger, .ml-chip--younger, .ml-badge--younger, .ml-squad--younger, .ml-focus__dot--younger {
  --ml-c: #3E9A6A; --ml-ct: #8FE0B0; --ml-cb: rgba(62, 154, 106, .2); --ml-cl: rgba(62, 154, 106, .6);
}
.ml-chip--all { --ml-c: var(--muted); --ml-ct: var(--text); --ml-cb: rgba(255, 255, 255, .1); --ml-cl: rgba(255, 255, 255, .4); }

.ml-hidden { display: none !important; }
.ml-ico { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Строка матча: полоса состава и бейдж ---------- */
.match.ml-lane { position: relative; }
.match.ml-lane::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--ml-c); pointer-events: none;
}
/* Подсветка строки, к которой перешли с графика: отдельный слой, анимируется только opacity
   (базовый transition у .match не переопределяем) */
.match.ml-flash::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 1px solid var(--jupiter); background: rgba(242, 137, 74, .14);
  animation: ml-flash 1.8s ease-out both;
}
@keyframes ml-flash { 0% { opacity: 0; } 12%, 60% { opacity: 1; } 100% { opacity: 0; } }

.ml-badge {
  display: inline-block; vertical-align: 1px; margin-right: 4px;
  font: 700 11px/1 "Golos Text", sans-serif; letter-spacing: .3px; white-space: nowrap;
  padding: 3px 7px; border-radius: 6px;
  color: var(--ml-ct); background: var(--ml-cb); border: 1px solid var(--ml-cl);
}

/* ---------- Панель над результатами: чипы составов + форма ---------- */
.ml-bar { display: grid; gap: 12px; min-width: 0; margin-top: -14px; margin-bottom: 20px; }

.ml-chips {
  position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-width: 0;
}
.ml-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 12px 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  font: 600 14px/1 "Golos Text", sans-serif; white-space: nowrap; cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.ml-chip__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ml-c); flex: none; }
.ml-chip--all .ml-chip__dot { display: none; }
.ml-chip__n {
  min-width: 24px; padding: 4px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .08); color: var(--muted);
}
.ml-chip:hover { color: var(--text); border-color: var(--ml-cl); }
.ml-chip.is-active { color: var(--text); background: var(--ml-cb); border-color: var(--ml-c); box-shadow: inset 0 0 0 1px var(--ml-c); }
.ml-chip.is-active .ml-chip__n { background: var(--ml-c); color: #0a0a0c; }
.ml-chip:focus-visible { border-radius: 999px; }

.ml-focus {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  padding: 12px 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ml-focus:empty { display: none; }
.ml-focus__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.ml-focus__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ml-c); align-self: center; flex: none; }
.ml-focus__name { font: 700 15px/1.2 "Unbounded", "Golos Text", sans-serif; letter-spacing: -.01em; }
.ml-focus__rec { font-size: 13px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.ml-focus__form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ml-focus__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }

.ml-empty { margin: 8px 0; text-align: center; color: var(--muted); font-size: 15px; }

/* ---------- Полоса формы В/Н/П и бейдж серии ---------- */
.ml-form { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.ml-form__c {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 11px/1 "Golos Text", sans-serif; font-style: normal; color: #0a0a0c; cursor: default;
}
.ml-form__c--w { background: var(--c-win); }
.ml-form__c--t { background: var(--c-tie); }
.ml-form__c--l { background: var(--c-loss); }
/* самый свежий матч — справа, с ободком */
.ml-form__c:last-child { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px rgba(255, 255, 255, .55); margin-left: 3px; }
.ml-form--xs { gap: 4px; }
.ml-form--xs .ml-form__c { width: 18px; height: 18px; font-size: 10px; }
.ml-form--xs .ml-form__c:last-child { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px rgba(255, 255, 255, .5); }

.ml-streak {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font: 700 12px/1 "Golos Text", sans-serif; padding: 6px 10px; border-radius: 999px;
}
.ml-streak--w { background: rgba(116, 221, 155, .15); color: var(--ice-2); }
.ml-streak--l { background: rgba(240, 83, 59, .15); color: #FF8A75; }
.ml-streak--t { background: rgba(138, 147, 166, .18); color: #BCC3D1; }
.ml-streak--xs { font-size: 11px; padding: 4px 8px; }

/* Турнирная таблица: форма второй строкой под названием команды */
.ml-stform { display: block; margin-top: 5px; font-weight: 400; line-height: 1; }
.ml-stform > * { vertical-align: middle; }
.ml-stform .ml-streak { margin-left: 8px; }

/* ---------- График «Сезон по матчам» ---------- */
.ml-tl {
  margin: -26px 0 46px; padding: 22px 24px 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ml-tl[hidden] { display: none; }
.ml-tl__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.ml-tl__title { font: 600 16px/1.2 "Unbounded", "Golos Text", sans-serif; letter-spacing: 0; margin: 0; }
.ml-tl__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.ml-tl__lg { display: inline-flex; align-items: center; gap: 6px; }
.ml-tl__lg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.ml-tl__lg-w { background: var(--c-win); }
.ml-tl__lg-l { background: var(--c-loss); }
.ml-tl__lg i.ml-tl__lg-p { width: 16px; height: 3px; border-radius: 2px; background: var(--jupiter); }
.ml-tl__wrap { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.ml-tl__svg { display: block; max-width: none; }
.ml-tl__zero { stroke: rgba(255, 255, 255, .24); stroke-width: 1; }
.ml-tl__base { stroke: rgba(255, 255, 255, .12); stroke-width: 1; stroke-dasharray: 3 5; }
.ml-tl__bar { cursor: pointer; }
.ml-tl__bar:focus, .ml-tl__bar:focus-visible { outline: none; }
.ml-tl__hit { fill: transparent; }
@media (hover: hover) { .ml-tl__bar:hover .ml-tl__hit { fill: rgba(255, 255, 255, .06); } }
.ml-tl__bar:active .ml-tl__hit { fill: rgba(255, 255, 255, .09); }
.ml-tl__bar:focus-visible .ml-tl__hit { fill: rgba(255, 255, 255, .06); stroke: var(--ice); stroke-width: 2; }
.ml-tl__up, .ml-tl__dn {
  transform-box: fill-box; transform: scaleY(0);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms);
}
.ml-tl__up { fill: var(--c-win); transform-origin: 50% 100%; }
.ml-tl__dn { fill: var(--c-loss); transform-origin: 50% 0; }
.ml-tl__svg.is-grown .ml-tl__up, .ml-tl__svg.is-grown .ml-tl__dn { transform: none; }
.ml-tl__v { font: 700 10px/1 "Golos Text", sans-serif; fill: var(--muted); opacity: 0; transition: opacity .3s .6s; }
.ml-tl__x { font: 500 11px/1 "Golos Text", sans-serif; fill: var(--muted); }
.ml-tl__line {
  fill: none; stroke: var(--jupiter); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s ease .25s; pointer-events: none;
}
.ml-tl__svg.is-grown .ml-tl__line { stroke-dashoffset: 0; }
.ml-tl__dot { fill: var(--bg); stroke: var(--jupiter); stroke-width: 2; opacity: 0; transition: opacity .3s .9s; pointer-events: none; }
.ml-tl__pts { font: 700 12px/1 "Golos Text", sans-serif; fill: var(--jupiter); opacity: 0; transition: opacity .3s 1s; }
.ml-tl__svg.is-grown .ml-tl__v, .ml-tl__svg.is-grown .ml-tl__dot, .ml-tl__svg.is-grown .ml-tl__pts { opacity: 1; }
.ml-tl__hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

/* ---------- Главная: три состава клуба ---------- */
.ml-squads__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ml-squad {
  display: grid; gap: 10px; align-content: start; min-width: 0; padding: 14px 16px;
  border-radius: var(--radius-sm); background: rgba(0, 0, 0, .24); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.ml-squad--main { background: linear-gradient(140deg, rgba(224, 96, 48, .14), rgba(0, 0, 0, .24)); border-color: rgba(242, 137, 74, .45); }
.ml-squad:hover { border-color: var(--ml-c); transform: translateY(-2px); }
.ml-squad:focus-visible { border-radius: var(--radius-sm); }
.ml-squad__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.ml-squad__name { display: inline-flex; align-items: center; gap: 8px; font: 700 14px/1.2 "Unbounded", "Golos Text", sans-serif; letter-spacing: -.01em; white-space: nowrap; }
.ml-squad__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ml-c); flex: none; }
.ml-squad__note { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); white-space: nowrap; }
@media (max-width: 360px) { .ml-squad__note { letter-spacing: .1px; font-size: 10.5px; } }   /* 320 px: «2016 г.р.» не шире своей строки */
.ml-squad__mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.ml-squad__place { display: inline-flex; align-items: flex-end; gap: 7px; }
.ml-squad__place b { font: 800 30px/1 "Unbounded", "Golos Text", sans-serif; color: var(--ml-ct); font-variant-numeric: tabular-nums; }
.ml-squad__place small { font-size: 12px; line-height: 1.3; color: var(--muted); padding-bottom: 1px; }
.ml-squad__rec { font-size: 13px; line-height: 1.35; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ml-squad__bot { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ml-squad__last { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }

/* ---------- Медиа → «Видео» ---------- */
.ml-videos { display: grid; gap: 16px; min-width: 0; }
.ml-videos__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.ml-videos__title { display: inline-flex; align-items: center; gap: .45em; margin: 0; font: 600 18px/1.2 "Unbounded", "Golos Text", sans-serif; letter-spacing: 0; }
.ml-videos__title .ico { color: var(--jupiter); }
.ml-videos__sub { font-size: 13px; color: var(--muted); }
/* 3 / 2 / 1 колонки: первые шесть карточек всегда закрывают ряды целиком;
   dense — чтобы открытый на всю строку плеер не оставлял дыр в сетке */
.ml-vgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 16px; }

.ml-vcard {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .2s;
}
.ml-vcard:hover { border-color: rgba(224, 96, 48, .45); }
.ml-vcard--w { --ml-vg: rgba(62, 154, 106, .34); --ml-vt: var(--ice-2); }
.ml-vcard--l { --ml-vg: rgba(218, 78, 56, .30); --ml-vt: #FF8A75; }
.ml-vcard--t { --ml-vg: rgba(138, 147, 166, .26); --ml-vt: #BCC3D1; }

.ml-vcard__frame {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 4px;
  width: 100%; aspect-ratio: 16 / 9; padding: 46px 88px 14px 16px; margin: 0;
  border: 0; border-bottom: 1px solid var(--border); cursor: pointer; text-align: left;
  color: var(--text); font-family: "Golos Text", sans-serif;
  background: radial-gradient(130% 110% at 0% 0%, var(--ml-vg), transparent 68%), #121116;
  -webkit-tap-highlight-color: transparent;
}
.ml-vcard__frame:focus-visible { outline-offset: -3px; border-radius: var(--radius) var(--radius) 0 0; }
.ml-vcard__top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ml-vcard__top .ml-badge { margin: 0; background-color: rgba(10, 10, 12, .55); }
.ml-vcard__date { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ml-vcard__score {
  font: 800 40px/1 "Unbounded", "Golos Text", sans-serif; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: var(--ml-vt);
}
.ml-vcard__score i { font-style: normal; opacity: .6; margin: 0 .06em; }
.ml-vcard__opp { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 700; line-height: 1.3; }
.ml-vcard__res { font-size: 11.5px; font-weight: 700; line-height: 1.3; text-transform: uppercase; letter-spacing: .7px; color: var(--ml-vt); }
.ml-vcard__play {
  position: absolute; right: 16px; top: 50%; width: 56px; height: 56px; margin-top: -18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-jupiter); color: #1a0e05; box-shadow: 0 8px 22px rgba(224, 96, 48, .35);
  transition: transform .2s;
}
.ml-vcard__play svg { width: 26px; height: 26px; margin-left: 2px; }
.ml-vcard__frame:hover .ml-vcard__play { transform: scale(1.08); }

.ml-vcard__player { display: flex; flex-direction: column; background: #000; }
.ml-vcard__screen { position: relative; aspect-ratio: 16 / 9; background: #000; }
.ml-vcard__screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ml-vcard__offline {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px; text-align: center; color: var(--muted); font-size: 14px;
}
.ml-vcard__offline p { margin: 0; }
.ml-vcard__bar {
  display: flex; align-items: stretch; min-width: 0;
  border-top: 1px solid var(--border); background: #1b1a20;
}
.ml-vcard__cap {
  flex: 1 1 auto; min-width: 0; align-self: center; padding: 0 8px 0 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 13px/1.3 "Golos Text", sans-serif; color: var(--muted); font-variant-numeric: tabular-nums;
}
.ml-vcard__close {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--text);
  font: 600 14px/1 "Golos Text", sans-serif; cursor: pointer; white-space: nowrap;
}
.ml-vcard__close:hover { background: #26252c; }
.ml-vcard__close:focus-visible { outline-offset: -3px; border-radius: 0; }

.ml-vcard__body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 6px; }
.ml-vcard__meta { font-size: 13px; line-height: 1.45; color: var(--muted); }
.ml-vcard__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ml-vcard__tags span { font-size: 12px; font-weight: 600; line-height: 1.2; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ice); }
.ml-vcard__links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: auto; }
.ml-vcard__ext { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ice); }
.ml-vcard__ext:hover { text-decoration: underline; }

.ml-more {
  justify-self: center; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 15px/1 "Golos Text", sans-serif; cursor: pointer; transition: border-color .2s;
}
.ml-more:hover { border-color: var(--ice); }
.ml-more:focus-visible { border-radius: 999px; }

/* Открытый плеер на широком экране занимает всю строку сетки */
@media (min-width: 700px) {
  .ml-vcard.is-playing { grid-column: 1 / -1; }
  .ml-vcard.is-playing .ml-vcard__player { width: 100%; max-width: 960px; margin: 0 auto; }
}

/* ---------- Планшет и телефон ---------- */
@media (max-width: 980px) {
  .ml-vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .ml-squads__list { grid-template-columns: 1fr; gap: 8px; }
  .ml-squad { gap: 8px; padding: 12px 14px; }
  .ml-squad:hover { transform: none; }
  .ml-squad__place b { font-size: 26px; }
}

@media (max-width: 640px) {
  /* чипы — горизонтальная snap-лента, страница вбок не ездит */
  .ml-chips {
    flex-wrap: nowrap; justify-content: flex-start;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    /* лента уходит под края экрана (поля раздела — clamp(16px, 4vw, 40px)), а не обрезается по полю */
    --ml-gut: clamp(16px, 4vw, 40px);
    margin-inline: calc(-1 * var(--ml-gut)); padding: 2px var(--ml-gut); scroll-padding-inline: var(--ml-gut);
  }
  .ml-chips::-webkit-scrollbar { display: none; }
  .ml-chip { scroll-snap-align: start; }

  .ml-bar { margin-top: -18px; margin-bottom: 16px; }
  .ml-focus { padding: 12px 14px; }
  .ml-focus__name { font-size: 14px; }
  .match.ml-lane::before { top: 14px; bottom: 14px; }
  /* длинные названия соперников («Балтийские Крылья») переносим, а не выталкиваем за экран */
  .match.ml-lane .match__teams { flex-wrap: wrap; row-gap: 2px; }
  .match.ml-lane .match__teams > span { min-width: 0; overflow-wrap: anywhere; }

  .ml-tl { padding: 16px 14px 12px; margin-top: -26px; }
  .ml-tl__legend { font-size: 12px; }

  .ml-videos__title { font-size: 16px; }
  .ml-vgrid { grid-template-columns: 1fr; gap: 14px; }
  .ml-more { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .ml-chip, .ml-squad, .ml-vcard, .ml-vcard__play, .ml-more,
  .ml-tl__up, .ml-tl__dn, .ml-tl__v, .ml-tl__line, .ml-tl__dot, .ml-tl__pts { transition: none; }
  .match.ml-flash::after { animation: none; }
  .ml-squad:hover, .ml-vcard__frame:hover .ml-vcard__play { transform: none; }
}
.ml-focus__team + .ml-focus__team { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* очень узкие телефоны (≤380px): три фильтра «Обе / 2016-2 / 2015-2» помещаются в одну строку */
@media (max-width: 380px) {
  .ml-chips { gap: 6px; }
  .ml-chip { gap: 6px; padding: 0 9px 0 11px; font-size: 13px; }
  .ml-chip__n { min-width: 20px; padding: 3px 5px; }
}

/* Зачёты ДХЛ: строка «Всего в ДХЛ («Серебро» + «Золото»)» под цифрами своего дивизиона */
.ml-focus__all { flex-basis: 100%; font-size: 12.5px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.ml-squad__all { font-size: 12px; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
