/* Live olympic: геометрия tsb-classic + визуал публичной сетки турнира */

.tob {
  margin: 0 0 12px;
  --tob-lime: #B7E000;
  --tob-lime-light: #E8F5A3;
  --tob-text: #1F1F1F;
}

.tob__classic {
  background: #F6F7F8;
  border: none;
  border-radius: 0 0 8px 8px;
  margin-top: 0;
  padding: 12px 16px 20px;
}

.tob .tsb-classic__round {
  width: 268px;
  margin-right: var(--tob-gap, 36px);
}

.tob .tsb-classic__half-tag--top {
  background: var(--tob-lime);
  color: var(--tob-text);
}

.tob .tsb-classic__half-tag--bottom {
  background: #E4E6E9;
  color: #3A3D42;
}

.tob .tsb-classic__round-title {
  height: auto;
  min-height: 24px;
  line-height: 1.25;
  margin-bottom: 8px;
  color: rgba(41, 43, 46, 0.55);
  font-family: 'Open Sans', 'Inter', sans-serif;
  font-weight: 600;
}

.tob .tsb-classic__match--half-start::before {
  background: #F6F7F8;
  color: #7a8086;
}

.tob__card {
  background: #fff;
  border: 1px solid #D2D7DD;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(53, 53, 53, 0.07);
  padding: 2px 4px 2px 4px;
  max-width: 252px;
  gap: 0;
}

.tob__vs {
  position: absolute;
  left: 36px;
  right: 8px;
  top: 50%;
  z-index: 3;
  height: 0;
  pointer-events: none;
}

.tob__vs::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: #E3E6EA;
}

.tob__vs b {
  position: absolute;
  left: 26%;
  top: 0;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  font-family: 'Open Sans', sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9AA1A8;
  background: #fff;
  padding: 0 4px;
  line-height: 1;
}

.tob__card--when .tob__vs {
  right: 74px;
}

.tob__match {
  text-decoration: none;
  color: inherit;
  overflow: visible;
}

.tob__match:hover .tob__card {
  border-color: var(--tob-lime);
}

.tob__match:hover .tob__score {
  box-shadow: 1px 1px 2px rgba(53, 53, 53, 0.16);
}

.tob a.tob__match {
  cursor: pointer;
}

/* Старые короткие хвостики tsb — выключаем, рисуем локти .tob__join */
.tob .tsb-classic__match::after {
  display: none;
}

/*
 * Локоть сетки (как ATP / Liquipedia):
 *  из пары матчей — две горизонтали + вертикаль + выход в следующий слот.
 */
.tob__join {
  position: absolute;
  left: 100%;
  top: 50%;
  width: var(--tob-stub, 18px);
  height: 2px;
  margin-top: -1px;
  background: #A8B0B8;
  pointer-events: none;
  z-index: 0;
}

/* Вертикаль: середина верхнего матча → середина нижнего */
.tob__match--pair-top .tob__join::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 2px;
  height: calc(var(--tsb-mh) * var(--tsb-span, 1));
  background: #A8B0B8;
}

/* Горизонталь в следующий круг — из центра вертикали */
.tob__match--pair-top .tob__join::before {
  content: '';
  position: absolute;
  left: calc(var(--tob-stub, 18px) - 2px);
  top: calc((var(--tsb-mh) * var(--tsb-span, 1)) / 2);
  width: calc(var(--tob-gap, 36px) - var(--tob-stub, 18px) + 2px);
  height: 2px;
  margin-top: -1px;
  background: #A8B0B8;
}

/* Подложка пар убрана: линии и так показывают «двое → один слот» */
.tob__pair-bg {
  display: none;
}

.tob__match .tob__card {
  position: relative;
  z-index: 1;
}

/* Строка как gameSetItem__result */
.tob__row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 34px;
  padding: 0;
  gap: 0;
  position: relative;
}

.tob__row--win {
  background: #EEF8E4;
  border-radius: 4px;
  padding: 2px 4px 2px 2px;
}

.tob__row--win::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  background: var(--tob-lime);
  border-radius: 2px;
  z-index: 3;
}

.tob__avaBox {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 2;
  box-sizing: border-box;
}

.tob__ava {
  width: 28px;
  height: 28px;
  margin: 2px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-sizing: border-box;
}

.tob__ava--text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.tob__ava--empty,
.tob__ava--tbd {
  background: #fff;
  box-shadow: 1px 1px 2px rgba(53, 53, 53, 0.1);
}

.tob__ava--tbd {
  background: #EEF0F2;
}

/* Скошенная плашка имени — как gameSetItem__userName */
.tob__plate {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0 4px;
  min-height: 29px;
  min-width: 0;
  flex: 1 1 0;
  max-width: none;
  margin-left: 0;
  margin-right: 6px;
  padding: 3px 8px 3px 8px;
  background: transparent;
  box-shadow: none;
  border: none;
  font-family: 'Open Sans', 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
}

.tob__name {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

/* Фамилия — один тон; цвет avatar-color только у буквенного аватара без фото */
.tob__surname {
  color: #1F1F1F;
  font-weight: 700;
  font-size: 13px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tob__row--win .tob__surname {
  color: #2D5A1A;
}

.tob__initial {
  color: #6F6F6F;
  font-weight: 500;
  font-size: 12px;
  flex-shrink: 0;
}

.tob__pending {
  color: #9AA0A6;
  font-style: italic;
  font-weight: 500;
}

.tob__bye {
  color: #8B9298;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0;
}

/* Дата — чип в колонке счёта, вне потока: иначе карточка выше слота и наезжает на соседа */
.tob__when {
  position: absolute;
  right: 0;
  top: 50%;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  width: auto;
  margin: 0;
  padding: 0;
  line-height: 1;
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  pointer-events: none;
}

.tob__when b {
  font-family: 'Open Sans', sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: #292B2E;
  background: #F3F5F7;
  padding: 0 5px;
  white-space: nowrap;
  box-shadow: none;
}

.tob__card--when {
  padding-top: 0;
}

.tob__card--when .tob__row {
  padding-right: 72px;
}

.tob__scores {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.tob__win-label {
  display: inline-block;
  min-width: 28px;
  margin-left: 5px;
  padding: 0 5px;
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 29px;
  text-align: center;
  color: #2D5A1A;
  background: #EEF8E4;
  transform: skew(-10deg);
  -webkit-transform: skew(-10deg);
  box-shadow: 1px 1px 2px rgba(53, 53, 53, 0.1);
}

.tob__score {
  width: 26px;
  height: 29px;
  margin-left: 5px;
  background: #fff;
  color: #292B2E;
  text-align: center;
  font-size: 14px;
  font-family: 'Open Sans', sans-serif;
  line-height: 29px;
  box-shadow: 1px 1px 2px rgba(53, 53, 53, 0.1);
  transform: skew(-10deg);
  -webkit-transform: skew(-10deg);
}

.tob__score b,
.tob__score span {
  display: inline-block;
  transform: skew(10deg);
  -webkit-transform: skew(10deg);
}

.tob__score--win {
  background: #EEF8E4;
  color: #2D5A1A;
}

.tob__score--win b {
  color: #2D5A1A;
}

.tob .tsb-classic__match--half-start::before {
  background: #F6F7F8;
}

.tob .is-active-round .tsb-classic__round-title {
  color: var(--tob-text);
}

.tob__round-window {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 400;
  color: rgba(41, 43, 46, 0.45);
  letter-spacing: 0;
}

.tob .tournament-bracket-scroll__chip:hover,
.tob .tournament-bracket-scroll__chip:focus {
  border-color: var(--tob-lime);
  background: #F5FBEA;
}

.tob .tournament-bracket-scroll__chip.is-active {
  background: var(--tob-lime);
  border-color: var(--tob-lime);
  color: var(--tob-text);
}

/* —— Сетка 64: компактнее, иначе ~2м высоты и «каша» из пар —— */
.tob--size-64 .tournament-bracket-scroll__viewport {
  max-height: min(78vh, 1200px);
}

.tob--size-64 .tob__classic {
  padding: 8px 12px 16px;
}

.tob--size-64 .tsb-classic__round {
  width: 240px;
}

.tob--size-64 .tsb-classic__match {
  padding: 7px 10px 7px 0;
}

.tob--size-64 .tob__card {
  max-width: 226px;
  gap: 0;
  padding: 1px 3px 1px 3px;
  border-radius: 5px;
}

.tob--size-64 .tob__vs {
  left: 26px;
}

.tob--size-64 .tob__card--when .tob__vs {
  right: 64px;
}

.tob--size-64 .tob__vs b {
  font-size: 8px;
  padding: 0 3px;
}

.tob--size-64 .tob__row {
  min-height: 24px;
}

.tob--size-64 .tob__avaBox {
  width: 24px;
  height: 24px;
}

.tob--size-64 .tob__ava {
  width: 20px;
  height: 20px;
}

.tob--size-64 .tob__ava--text {
  font-size: 8px;
}

.tob--size-64 .tob__plate {
  min-height: 22px;
  margin-left: 0;
  margin-right: 4px;
  padding: 1px 6px 1px 6px;
  font-size: 12px;
  line-height: 1.15;
}

.tob--size-64 .tob__surname {
  font-size: 12px;
}

.tob--size-64 .tob__initial,
.tob--size-64 .tob__seed {
  font-size: 10px;
}

.tob--size-64 .tob__score {
  width: 20px;
  height: 22px;
  font-size: 11px;
  line-height: 22px;
  margin-left: 3px;
}

.tob--size-64 .tob__win-label {
  min-width: 24px;
  margin-left: 3px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 22px;
}

.tob--size-64 .tob__when b {
  font-size: 9px;
  padding: 0 4px;
}

.tob--size-64 .tob__card--when .tob__row {
  padding-right: 62px;
}

.tob--size-64 .tob__round-window {
  font-size: 10px;
}

.tob--size-64 .tob__row--win::before {
  top: 3px;
  bottom: 3px;
  width: 2px;
}

/* Подложка пар на 64 — выключена, как на 32 */
.tob--size-64 .tob__pair-bg {
  display: none;
}

/* Четыре зоны посева A–D вместо двух половин */
.tob__rail--quarters {
  flex-basis: 40px;
  min-height: calc(var(--tsb-mh) * var(--tsb-r1));
}

.tob__qtag {
  position: absolute;
  left: 0;
  width: 36px;
  padding: 6px 2px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #1F1F1F;
  border-radius: 4px;
  box-sizing: border-box;
}

.tob__qtag--1 {
  top: 28px;
  height: calc(25% - 22px);
  background: var(--tob-lime);
}

.tob__qtag--2 {
  top: calc(25% + 10px);
  height: calc(25% - 22px);
  background: var(--tob-lime-light);
  color: #3A3D42;
}

.tob__qtag--3 {
  top: calc(50% + 10px);
  height: calc(25% - 22px);
  background: #E4E6E9;
  color: #3A3D42;
}

.tob__qtag--4 {
  bottom: 8px;
  height: calc(25% - 22px);
  background: #D7DBE0;
  color: #3A3D42;
}

@media (max-width: 720px) {
  .tob__classic {
    padding: 8px 10px 16px;
    --tob-gap: 28px;
    --tob-stub: 14px;
  }

  .tob .tsb-classic__round {
    width: 236px;
    margin-right: var(--tob-gap, 28px);
  }

  .tob__card {
    max-width: 220px;
  }

  .tob__avaBox {
    width: 28px;
    height: 28px;
  }

  .tob__ava {
    width: 24px;
    height: 24px;
  }

  .tob__plate {
    font-size: 12px;
    padding: 2px 8px 2px 14px;
    min-height: 26px;
  }

  .tob__surname {
    font-size: 12px;
  }

  .tob__score {
    width: 22px;
    height: 26px;
    font-size: 12px;
    line-height: 26px;
  }

  .tob--size-64 .tournament-bracket-scroll__viewport {
    max-height: 70vh;
  }

  .tob--size-64 .tsb-classic__round {
    width: 220px;
  }

  .tob--size-64 .tob__card {
    max-width: 206px;
  }

  .tob--size-64 .tob__rail--quarters {
    flex-basis: 32px;
  }

  .tob--size-64 .tob__qtag {
    width: 28px;
    font-size: 9px;
  }
}
