@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700");

/* ─── Container & responsive wrapper ──────────────────────────────────────── */

.tb-container {
  font-family: "Source Sans Pro", sans-serif;
  width: 100%;
  box-sizing: border-box;
}

.tb-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  padding-bottom: 12px;
}

/* Scrollbar styling for the wrapper */
.tb-responsive-wrapper::-webkit-scrollbar {
  height: 6px;
}
.tb-responsive-wrapper::-webkit-scrollbar-track {
  background: rgba(0,0,0,.1);
  border-radius: 3px;
}
.tb-responsive-wrapper::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.3);
  border-radius: 3px;
}

.tb-container .theme {
  position: relative;
  width: 100%;
  min-width: -webkit-fit-content;
  min-width: fit-content;
}

/* ─── Bracket layout ──────────────────────────────────────────────────────── */

.tb-container .bracket {
  display: flex;
  flex-direction: row;
  padding: 40px;
  margin: 5px;
  position: relative;
}

.tb-container .column {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-content: center;
}

/* ─── Match ───────────────────────────────────────────────────────────────── */

.tb-container .match {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  max-width: 200px;
  height: 62px;
  margin: 12px 24px 12px 0;
}

.tb-container .match .match-top {
  border-radius: 2px 2px 0 0;
}
.tb-container .match .match-bottom {
  border-radius: 0 0 2px 2px;
}

.tb-container .match .team {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  border: 1px solid black;
  position: relative;
  box-sizing: border-box;
}

.tb-container .match .team span {
  padding-left: 8px;
}
.tb-container .match .team span:last-child {
  padding-right: 8px;
}
.tb-container .match .team .name {
  line-height: 1.1;
}

.tb-container .match .team .score {
  margin-left: auto;
  flex-shrink: 0;
}
.tb-container .match .team:first-child {
  margin-bottom: -1px;
}

/* ─── Match header label ──────────────────────────────────────────────────── */

.tb-container .match-header {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  padding-bottom: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-container .theme-light .match-header { color: #9fafbf; }
.tb-container .theme-dark .match-header  { color: #6b798c; }
.tb-container .theme-dark-trendy .match-header { color: #6b798c; }

/* ─── Connector lines ─────────────────────────────────────────────────────── */

.tb-container .match-lines {
  display: block;
  position: absolute;
  top: 50%;
  bottom: 0;
  margin-top: 0;
  right: -1px;
}
.tb-container .match-lines .line {
  background: red;
  position: absolute;
}
.tb-container .match-lines .line.one {
  height: 1px;
  width: 12px;
}
.tb-container .match-lines .line.two {
  height: 44px;
  width: 1px;
  left: 11px;
}
.tb-container .match-lines.alt {
  left: -12px;
}

.tb-container .match:nth-child(even) .match-lines .line.two {
  transform: translate(0, -100%);
}

.tb-container .column:first-child .match-lines.alt {
  display: none;
}
.tb-container .column:last-child .match-lines {
  display: none;
}
.tb-container .column:last-child .match-lines.alt {
  display: block;
}

/* Connector line heights increase exponentially per column */
.tb-container .column:nth-child(2) .match-lines .line.two { height: 88px; }
.tb-container .column:nth-child(3) .match-lines .line.two { height: 175px; }
.tb-container .column:nth-child(4) .match-lines .line.two { height: 262px; }
.tb-container .column:nth-child(5) .match-lines .line.two { height: 349px; }
.tb-container .column:nth-child(6) .match-lines .line.two { height: 436px; }

/* ─── Theme: Light ────────────────────────────────────────────────────────── */

.tb-container .theme-light {
  background: #f9fafd;
}
.tb-container .theme-light .match-lines .line {
  background: #dadfe3;
}
.tb-container .theme-light .team {
  background: #fff;
  border-color: #dadfe3;
  color: #708392;
}
.tb-container .theme-light .winner-top .match-top,
.tb-container .theme-light .winner-bottom .match-bottom {
  background: #fff;
  color: #272f36;
  border-color: #dadfe3;
  z-index: 1;
}
.tb-container .theme-light .match .seed {
  color: #9fafbf;
  font-size: 12px;
  min-width: 10px;
}
.tb-container .theme-light .match .score {
  color: #9fafbf;
  font-size: 14px;
}

/* ─── Theme: Dark ─────────────────────────────────────────────────────────── */

.tb-container .theme-dark {
  background: #0e1217;
}
.tb-container .theme-dark .match-lines .line {
  background: #36404e;
}
.tb-container .theme-dark .team {
  background: #182026;
  border-color: #232c36;
  color: #6b798c;
}
.tb-container .theme-dark .winner-top .match-top,
.tb-container .theme-dark .winner-bottom .match-bottom {
  background: #232c36;
  color: #e3e8ef;
  border-color: #36404e;
  z-index: 1;
}
.tb-container .theme-dark .winner-top .match-top .score,
.tb-container .theme-dark .winner-bottom .match-bottom .score {
  color: #03d9ce;
}
.tb-container .theme-dark .match .seed {
  font-size: 12px;
  min-width: 10px;
}
.tb-container .theme-dark .match .score {
  font-size: 14px;
}

/* ─── Theme: Dark Trendy ──────────────────────────────────────────────────── */

.tb-container .theme-dark-trendy {
  background: linear-gradient(to right, #171721, #122b29);
}
.tb-container .theme-dark-trendy .match-lines .line {
  background: #36404e;
}
.tb-container .theme-dark-trendy .team {
  background: rgba(50, 54, 65, 0.4);
  color: #6b798c;
  border: 2px solid transparent;
}
.tb-container .theme-dark-trendy .team:first-child {
  margin-bottom: 2px;
}
.tb-container .theme-dark-trendy .team:last-child {
  margin-top: 2px;
}
.tb-container .theme-dark-trendy .winner-top .match-top,
.tb-container .theme-dark-trendy .winner-bottom .match-bottom {
  background: #323641;
  color: #e3e8ef;
  z-index: 1;
}
.tb-container .theme-dark-trendy .winner-top .match-top .score,
.tb-container .theme-dark-trendy .winner-bottom .match-bottom .score {
  color: #03d9ce;
}
.tb-container .theme-dark-trendy .match {
  margin-right: 48px;
}
.tb-container .theme-dark-trendy .match .team .name {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.tb-container .theme-dark-trendy .match .seed {
  display: none;
}
.tb-container .theme-dark-trendy .match .match-top,
.tb-container .theme-dark-trendy .match .match-bottom {
  border-radius: 0;
}
.tb-container .theme-dark-trendy .match-lines {
  opacity: 0.75;
  right: -12px;
}
.tb-container .theme-dark-trendy .match-lines .line {
  background: #03d9ce;
}
.tb-container .theme-dark-trendy .match-lines.alt {
  left: -24px;
}
.tb-container .theme-dark-trendy .team {
  overflow: hidden;
}
.tb-container .theme-dark-trendy .score:before {
  opacity: 0.25;
  position: absolute;
  z-index: 1;
  content: "";
  display: block;
  background: black;
  min-height: 50px;
  min-width: 70px;
  transform: translate(-12px, 0) rotate(25deg);
}

/* ─── Modifier classes ────────────────────────────────────────────────────── */

.tb-container .disable-image .image,
.tb-container .disable-seed .seed,
.tb-container .disable-name .name,
.tb-container .disable-score .score {
  display: none !important;
}

/* ─── Final round: show outgoing connector, no vertical bar ──────────────── */

.tb-container .tb-final-round .match-lines {
  display: block;
}
.tb-container .tb-final-round .match-lines .line.two {
  display: none;
}

/* ─── Champion column ─────────────────────────────────────────────────────── */

.tb-container .tb-champion-column {
  justify-content: center;
}

.tb-container .tb-champion {
  position: relative;
  display: flex;
  align-items: center;
}

.tb-container .tb-champion-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 4px;
  white-space: nowrap;
}

.tb-container .tb-trophy {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}

.tb-container .tb-champion-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 20px;
  line-height: 1;
}

.tb-container .tb-winner-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.tb-container .tb-champion-name {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.15;
}

/* Theme-specific champion styles */
.tb-container .theme-light .tb-champion-box {
  background: #fff;
  border: 2px solid #f0c040;
}
.tb-container .theme-light .tb-champion-info {
  color: #272f36;
}
.tb-container .theme-light .tb-winner-label {
  color: #c8960a;
}
.tb-container .theme-light .tb-champion-name {
  color: #272f36;
}
.tb-container .theme-light .tb-champion .match-lines.alt .line {
  background: #dadfe3;
}

.tb-container .theme-dark .tb-champion-box {
  background: #232c36;
  border: 2px solid #f0c040;
}
.tb-container .theme-dark .tb-winner-label {
  color: #f0c040;
}
.tb-container .theme-dark .tb-champion-name {
  color: #e3e8ef;
}
.tb-container .theme-dark .tb-champion .match-lines.alt .line {
  background: #36404e;
}

.tb-container .theme-dark-trendy .tb-champion-box {
  background: #323641;
  border: 2px solid #03d9ce;
}
.tb-container .theme-dark-trendy .tb-winner-label {
  color: #03d9ce;
}
.tb-container .theme-dark-trendy .tb-champion-name {
  color: #e3e8ef;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 15px;
}
.tb-container .theme-dark-trendy .tb-champion .match-lines.alt .line {
  background: #03d9ce;
}

/* ─── Optional inline theme switcher ─────────────────────────────────────── */

.tb-container .theme-switcher {
  position: relative;
  padding: 16px;
  margin: 8px;
  border: 1px solid #c0cfdd;
  background: #6b798c;
  display: inline-block;
}
.tb-container .theme-switcher h2 {
  color: #e1e8ef;
  text-transform: uppercase;
  font-size: 12px;
  margin: 0 0 10px 0;
}
.tb-container .theme-switcher .tb-theme-btn {
  line-height: 1em;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 2px;
  cursor: pointer;
  background: #6b798c;
  color: #ccc;
  border: 1px solid #eee;
  margin-right: 4px;
}
.tb-container .theme-switcher .tb-theme-btn:hover {
  background: #505b69;
}

/* ─── Empty state ─────────────────────────────────────────────────────────── */

.tb-container .tb-empty {
  color: #888;
  font-style: italic;
  padding: 16px;
}
