/* Публичный посев олимпийской сетки на странице турнира */
.tsb {
  margin: 24px 0 32px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
}
.tsb__title {
  margin: 0 0 8px;
  font-size: 22px;
}
.tsb__hint {
  margin: 0 0 12px;
  color: #666;
  font-size: 14px;
  line-height: 1.4;
}
.tsb-size {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 4px;
}
.tsb-size__btn {
  flex: 1 1 200px;
  text-align: left;
  padding: 12px 14px;
  border: 2px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.tsb-size__btn:hover {
  border-color: #888;
}
.tsb-size__btn.is-active {
  border-color: #2e7d32;
  box-shadow: 0 0 0 1px #2e7d32;
  background: #f3faf3;
}
.tsb-size__label {
  display: block;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}
.tsb-size__meta {
  display: block;
  font-size: 13px;
  color: #666;
  line-height: 1.35;
}
.tsb__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.tsb__toolbar--start {
  align-items: center;
  margin-bottom: 12px;
}
.tsb__toolbar--start .tsb__confirm {
  margin: 0;
}
.tsb__fill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 320px;
  min-height: 52px;
  padding: 14px 28px;
  border: 0;
  border-radius: 6px;
  background: #2f80ed;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
.tsb__fill-btn:hover:not(:disabled) {
  background: #1b6fd6;
}
.tsb__fill-btn:disabled {
  background: #a0b9d8;
  cursor: not-allowed;
  box-shadow: none;
}
.tsb__status {
  margin: 8px 0;
  padding: 8px 10px;
  background: #eef7ee;
  border-radius: 4px;
  font-size: 13px;
}
.tsb__status.is-error {
  background: #fdeaea;
  color: #a94442;
}
.tsb__counts {
  margin-bottom: 12px;
  font-size: 13px;
  color: #444;
}
.tsb__layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
}
.tsb__subtitle {
  margin: 0 0 8px;
  font-size: 15px;
}
.tsb__pool {
  border: 1px dashed #aaa;
  border-radius: 4px;
  padding: 8px;
  background: #fff;
  min-height: 120px;
}
.tsb__pool.is-over {
  outline: 2px solid #5cb85c;
  background: #eef9ee;
}
.tsb__empty {
  color: #999;
  font-size: 13px;
}
.tsb__pairs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.tsb-pair {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px;
  position: relative;
}
.tsb-pair--top {
  border-right: 3px solid #b7e35d;
}
.tsb-pair--bottom {
  border-right: 3px solid #b7e35d;
  margin-bottom: 8px;
}
.tsb-pair__num {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 11px;
  color: #999;
}
.tsb-slot {
  min-height: 44px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  margin: 4px 0;
  padding: 4px 6px 4px 34px;
  position: relative;
  background: #f7f7f7;
}
.tsb-slot.is-over {
  outline: 2px solid #5cb85c;
  background: #eef9ee;
}
.tsb-slot__pos {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #888;
  width: 22px;
}
.tsb-chip {
  cursor: grab;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.25;
}
.tsb-chip.is-selected,
.tsb-chip.is-dragging {
  outline: 2px solid #337ab7;
}
.tsb-chip__meta {
  color: #888;
  font-size: 11px;
}
.tsb-chip__bye {
  color: #d9534f;
  font-weight: 700;
  margin-left: 4px;
  font-size: 11px;
}
.tsb__start {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
}
.tsb__schedule-lead {
  margin: 0 0 10px;
}
.tsb__dates {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-width: 720px;
}
.tsb__date-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
}
.tsb__date-label {
  flex: 0 0 108px;
  font-size: 13px;
  font-weight: 700;
  color: #222;
  line-height: 1.25;
  padding-bottom: 8px;
}
.tsb__date-fields {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}
.tsb__date-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  font-size: 13px;
  flex: 1 1 0;
  min-width: 0;
}
.tsb__date-cap {
  color: #666;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tsb__date-input {
  width: 100%;
  height: 36px;
  padding: 4px 8px;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  color: #111;
  box-sizing: border-box;
}
.tsb__date-input:focus {
  outline: none;
  border-color: #2f80ed;
  box-shadow: 0 0 0 2px rgba(47, 128, 237, 0.2);
}
.tsb__date-input[readonly] {
  background: #f3f5f7;
  color: #444;
  cursor: default;
}
.tsb__date-input--end {
  border-color: #2f80ed;
  background: #f7fbff;
}
.tsb__date-input.is-invalid {
  border-color: #d9534f;
  background: #fff5f5;
}
.tsb__date-days {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  width: auto;
  min-width: 52px;
  max-width: 72px;
  margin: 0;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4fc;
  color: #1b6fd6;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-sizing: border-box;
}
.tsb__confirm {
  display: block;
  margin: 8px 0 12px;
  font-size: 13px;
}
.tsb__confirm.is-warn {
  outline: 2px solid #d9534f;
  outline-offset: 4px;
  border-radius: 4px;
}
.tsb__start-msg {
  margin: 8px 0 0;
  font-size: 13px;
  color: #a94442;
  min-height: 1.2em;
}
.tsb__start-msg:empty {
  display: none;
}
.tsb__step {
  margin: 16px 0 20px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
}
@media (max-width: 640px) {
  .tsb__date-row {
    flex-wrap: wrap;
  }
  .tsb__date-label {
    flex: 1 0 100%;
    padding-bottom: 0;
  }
  .tsb__date-fields {
    flex: 1 1 100%;
  }
  .tsb__fill-btn {
    min-width: 0;
    width: 100%;
  }
}
.tsb__note {
  margin: 0 0 10px;
  font-size: 13px;
  color: #666;
}
.tsb__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 3px;
  background: #fff3cd;
  color: #856404;
  font-size: 12px;
}
.tsb__badge--ok {
  background: #dff0d8;
  color: #3c763d;
}
.tsb-seed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.tsb-seed-row {
  display: grid;
  grid-template-columns: 52px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  cursor: grab;
  font-size: 13px;
}
.tsb-seed-row:last-child {
  border-bottom: 0;
}
.tsb-seed-row.is-dragging {
  opacity: 0.55;
}
.tsb-seed-row.is-over {
  outline: 2px solid #5cb85c;
}
.tsb-seed-row--loose {
  grid-template-columns: 52px 1fr auto;
  margin-bottom: 6px;
  border: 1px dashed #bbb;
  border-radius: 3px;
}
.tsb-seed-row__num {
  font-weight: 700;
  color: #337ab7;
}
.tsb-seed-row__name {
  font-weight: 600;
}
.tsb-seed-row__meta {
  color: #888;
  font-size: 12px;
}
.tsb-seed-row__actions {
  display: flex;
  gap: 4px;
}
.tsb-seed-row__btn {
  min-width: 28px;
  padding: 2px 6px;
  cursor: pointer;
}
.tsb__unseeded {
  margin-bottom: 10px;
}
.tsb__pairs--dim {
  opacity: 0.45;
  pointer-events: none;
}
.tsb-bracket {
  margin-top: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #F6F7F8;
  overflow: hidden;
}
.tsb-bracket--dim {
  opacity: 0.72;
}
.tsb-bracket .tournament-bracket-scroll {
  margin: 0;
}
.tsb-bracket .tournament-bracket-scroll__viewport {
  max-height: none;
}
.tsb-bracket .gamesSetsItem_groupTop,
.tsb-bracket .gamesSetsItem_groupTop:hover {
  border: 2px solid #d1ef45 !important;
  border-radius: 0 8px 0 0;
  border-bottom: none !important;
  border-left: none !important;
  padding-top: 12px;
  padding-right: 12px;
}
.tsb-bracket .gamesSetsItem_groupBottom,
.tsb-bracket .gamesSetsItem_groupBottom:hover {
  border: 2px solid #d1ef45 !important;
  border-radius: 0 0 8px 0;
  border-top: none !important;
  border-left: none !important;
  padding-bottom: 12px;
  padding-right: 12px;
  margin-bottom: 18px;
}
.tsb-seed-meta {
  margin-left: 6px;
  color: #888;
  font-size: 12px;
  font-weight: 400;
}
.tsb-bye-label {
  color: #d9534f;
}
.tsb-chip {
  cursor: default;
}
@media (max-width: 900px) {
  .tsb__layout {
    grid-template-columns: 1fr;
  }
  .tsb-seed-row {
    grid-template-columns: 48px 1fr;
  }
  .tsb-seed-row__meta,
  .tsb-seed-row__actions {
    grid-column: 2;
  }
}

/* ===== Классическая вертикальная сетка (чисто) ===== */
.tsb-classic {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  margin-top: 10px;
  padding: 14px 12px 18px;
  background: #f3f4f5;
  border: 1px solid #dde1e4;
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tsb-classic--dim { opacity: 0.72; }

/* Сетка 64: компактнее карточки, иначе ~3м высоты */
.tsb-classic--size-64 {
  --tsb-mh: 56px;
  max-height: min(78vh, 1400px);
  overflow-y: auto;
}
.tsb-classic--size-64 .tsb-classic__round {
  width: 220px;
  margin-right: 14px;
}
.tsb-classic--size-64 .tsb-classic__card {
  max-width: 204px;
  padding: 3px 5px;
}
.tsb-classic--size-64 .tsb-crow__name {
  font-size: 12px;
}
.tsb-classic--size-64 .tsb-classic__match {
  padding: 3px 10px 3px 0;
}

.tsb-classic__rail {
  position: relative;
  flex: 0 0 44px;
  align-self: stretch;
  min-height: calc(var(--tsb-mh) * var(--tsb-r1));
  margin-right: 8px;
}
.tsb-classic__half-tag {
  position: absolute;
  left: 0;
  width: 40px;
  padding: 10px 2px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #333;
  border-radius: 4px;
}
.tsb-classic__half-tag--top {
  top: 28px;
  height: calc(50% - 40px);
  background: #d1ef45;
}
.tsb-classic__half-tag--bottom {
  bottom: 8px;
  height: calc(50% - 40px);
  background: #d9dce0;
}

.tsb-classic__tree {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  min-width: max-content;
}
.tsb-classic__round {
  display: flex;
  flex-direction: column;
  width: 248px;
  margin-right: 18px;
}
.tsb-classic__round-title {
  height: 24px;
  margin: 0 0 6px 4px;
  font-size: 13px;
  font-weight: 700;
  color: #6a6e73;
  line-height: 24px;
}
.tsb-classic__matches {
  display: flex;
  flex-direction: column;
  min-height: calc(var(--tsb-mh) * var(--tsb-r1));
}
.tsb-classic__match {
  box-sizing: border-box;
  height: calc(var(--tsb-mh) * var(--tsb-span, 1));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 12px 6px 0;
  position: relative;
}
.tsb-classic__match--half-start {
  border-top: 1px dashed #b0b5ba;
}
.tsb-classic__match--half-start::before {
  content: 'низ · №2';
  position: absolute;
  top: -9px;
  left: 8px;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  color: #7a8086;
  background: #f3f4f5;
  padding: 0 6px;
}

/* карточка матча */
.tsb-classic__card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 228px;
  padding: 5px 6px;
  background: #fff;
  border: 1px solid #cfd4d8;
  border-radius: 6px;
}
/* хвостик к следующему кругу */
.tsb-classic__match::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 12px;
  height: 1px;
  background: #b7c0c7;
}
.tsb-classic__round:last-child .tsb-classic__match::after {
  display: none;
}

/* строка игрока: посев | имя | бейдж */
.tsb-crow {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 2px;
  border-radius: 3px;
}
.tsb-crow--pt {
  background: #f4fbe8;
}
.tsb-crow--from-bye {
  background: #f7f8f9;
}
.tsb-crow--bye .tsb-crow__name {
  color: #c0392b;
  font-weight: 700;
  font-style: italic;
}
.tsb-crow--pending .tsb-crow__name {
  color: #8a9096;
  font-weight: 600;
  font-style: italic;
}
.tsb-crow__seed {
  font-size: 12px;
  font-weight: 700;
  color: #2f80ed;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tsb-crow__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: #1f1f1f;
  line-height: 1.25;
}
.tsb-crow__badge {
  font-size: 11px;
  font-weight: 700;
  color: #8a9096;
  text-align: center;
  white-space: nowrap;
}
.tsb-crow--from-bye .tsb-crow__badge {
  color: #6a6e73;
}
.tsb-crow--pt .tsb-crow__badge {
  color: #5a7a20;
}

@media (max-width: 720px) {
  .tsb-classic__round { width: 220px; margin-right: 12px; }
  .tsb-classic__card { max-width: 200px; }
  .tsb-classic__rail { flex-basis: 34px; }
}
