/* =========================================
   Team tournament match history
   ========================================= */

.team-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.team-history-column {
  min-width: 0;
}

.team-history-column__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.team-history-column__head span {
  color: #ffdf00;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.team-history-column__head h2 {
  margin: 2px 0 0;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
}

.team-history-column__head p {
  margin: 0;
  color: rgba(255, 255, 255, .5);
  font-size: .75rem;
  font-weight: 800;
}

.team-history-list {
  display: grid;
  gap: 9px;
}

.team-history-group {
  overflow: hidden;
  /* border: 1px solid rgba(255, 255, 255, .1); */
  border-radius: 10px;
  background: #111216;
}

.team-history-group__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 9px 11px;
  cursor: pointer;
  list-style: none;
}

.team-history-group__summary::-webkit-details-marker {
  display: none;
}

.team-history-group__summary:hover {
  background: rgba(255, 223, 0, .035);
}

.team-history-group__identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.team-history-group__identity>i {
  display: grid;
  flex: 0 0 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 223, 0, .25);
  border-radius: 8px;
  color: #ffdf00;
}

.team-history-group__identity div {
  min-width: 0;
}

.team-history-group__identity small {
  display: block;
  overflow: hidden;
  color: rgba(255, 255, 255, .48);
  font-size: .6rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.team-history-group__identity strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #fff;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-history-group__record {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.team-history-group__record span {
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .65);
  font-size: .6rem;
  font-weight: 900;
}

.team-history-group__record i {
  margin-left: 2px;
  color: rgba(255, 255, 255, .5);
  font-size: .75rem;
  transition: transform .2s ease;
}

.team-history-group[open] .team-history-group__record i {
  transform: rotate(180deg);
}

.team-history-group__body {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.team-history-group__body .team-history-card {
  background: rgba(0, 0, 0, .2);
}

.team-history-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid rgba(255, 223, 0, .55);
  border-radius: 10px;
  background: #0d0e12;
}

.team-history-card--win {
  border-left-color: #69dc7d;
}

.team-history-card--loss {
  border-left-color: #ff6868;
}

.team-history-card--unscheduled {
  border-left-color: #ffdf00;
}

.team-history-card--scheduled,
.team-history-card--upcoming {
  border-left-color: #65a8ff;
}

.team-history-card__meta,
.team-history-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.team-history-card__meta span {
  overflow: hidden;
  color: rgba(255, 255, 255, .55);
  font-size: .67rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-history-card__meta strong {
  color: #ffdf00;
  font-size: .62rem;
  text-transform: uppercase;
}

.team-history-card__matchup {
  display: grid;
  grid-template-columns: 82px 20px 82px;
  justify-content: center;
  align-items: start;
  gap: 3px;
  margin: 10px 0;
  padding: 12px 8px 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  background: #111318;
}

.team-history-team {
  display: grid;
  grid-template-columns: 40px 36px;
  grid-template-rows: 40px auto;
  justify-content: start;
  align-items: center;
  min-width: 0;
  column-gap: 6px;
  row-gap: 6px;
}

.team-history-team--opponent {
  grid-template-columns: 36px 40px;
  justify-content: end;
}

.team-history-team img,
.team-history-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;

}

.team-history-team img {
  object-fit: cover;
}

.team-history-logo {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 223, 0, .2);
  background: rgba(255, 223, 0, .06);
  color: #ffdf00;
  font-size: .58rem;
  font-weight: 900;
}

.team-history-team img,
.team-history-team .team-history-logo {
  grid-column: 1;
  grid-row: 1;
}

.team-history-team strong {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  overflow: visible;
  max-width: 82px;
  color: #fff;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-history-team>b {
  grid-column: 2;
  grid-row: 1 / 3;
  display: grid;
  align-self: stretch;
  place-items: center;
  color: #ffdf00;
  font-size: 1.05rem;
  font-weight: 950;
  text-align: center;
}

.team-history-team--opponent>b {
  grid-column: 1;
  grid-row: 1 / 3;
}

.team-history-team--opponent img,
.team-history-team--opponent .team-history-logo {
  grid-column: 2;
  grid-row: 1;
}

.team-history-team--opponent strong {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  text-align: center;
}

/* MATCHUP POSITION CONTROLS
   translate(horizontal, vertical): negative = left/up, positive = right/down. */

/* LEFT of VS */
.team-history-team:not(.team-history-team--opponent)>img,
.team-history-team:not(.team-history-team--opponent)>.team-history-logo {
  transform: translate(-30px, 0px);
  /* team logo */
}

.team-history-team:not(.team-history-team--opponent)>strong {
  transform: translate(-30px, 0px);
  /* team name */
}

.team-history-team:not(.team-history-team--opponent)>b {
  transform: translate(-15px, 0px);
  /* team score */
}

/* RIGHT of VS */
.team-history-team--opponent>img,
.team-history-team--opponent>.team-history-logo {
  transform: translate(30px, 0px);
  /* team logo */
}

.team-history-team--opponent>strong {
  transform: translate(30px, 0px);
  /* team name */
}

.team-history-team--opponent>b {
  transform: translate(15px, 0px);
  /* team score */
}

.team-history-versus {
  display: grid;
  align-self: stretch;
  height: auto;
  margin-top: 0;
  place-items: center;
  color: rgba(255, 255, 255, .42);
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: center;
}

.team-history-card__meta {
  min-height: 18px;
}

.team-history-card__meta span {
  letter-spacing: .025em;
}

.team-history-card__foot {
  min-height: 22px;
}

.team-history-card__foot {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.team-history-card__foot small {
  color: rgba(255, 255, 255, .42);
  font-size: .65rem;
}

.team-history-card__foot a {
  color: #ffdf00;
  font-size: .68rem;
  font-weight: 850;
  text-decoration: none;
}

.team-history-empty {
  display: grid;
  min-height: 110px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: 10px;
  color: rgba(255, 255, 255, .45);
  font-size: .76rem;
}

.team-history-empty i {
  color: #ffdf00;
  font-size: 1.25rem;
}

@media(max-width:1000px) {
  .team-history-grid {
    grid-template-columns: 1fr
  }

  .team-history-column {
    margin-bottom: 10px
  }
}

.team-match-history {
  display: grid;
  gap: 18px;
}

.team-match-history__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.team-match-history__head span {
  color: #ffdf00;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-match-history__head h2 {
  margin: 3px 0 0;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
}

.team-match-history__head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
  font-weight: 700;
}

.team-tournament-list {
  display: grid;
  gap: 14px;
}

.team-tournament-group {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #111216;
}

.team-tournament-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.team-tournament-summary::-webkit-details-marker {
  display: none;
}

.team-tournament-summary:hover {
  background: rgba(255, 223, 0, 0.035);
}

.team-tournament-summary__identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.team-tournament-summary__icon {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 223, 0, 0.28);
  border-radius: 10px;
  background: rgba(255, 223, 0, 0.06);
  color: #ffdf00;
}

.team-tournament-summary__identity span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.team-tournament-summary__identity h3 {
  overflow: hidden;
  margin: 3px 0 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-tournament-summary__record {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.team-tournament-summary__record span {
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  font-weight: 900;
}

.team-tournament-summary__record i {
  color: rgba(255, 255, 255, 0.55);
  transition: transform 0.2s ease;
}

.team-tournament-group[open] .team-tournament-summary__record i {
  transform: rotate(180deg);
}

.team-match-tree {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 4px 16px 16px 44px;
}

.team-match-tree::before {
  position: absolute;
  top: 4px;
  bottom: 16px;
  left: 25px;
  width: 2px;
  background: rgba(255, 223, 0, 0.18);
  content: "";
}

.team-match-row {
  position: relative;
}

.team-match-tree__node {
  position: absolute;
  top: 25px;
  left: -27px;
  z-index: 2;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 3px solid #111216;
  border-radius: 50%;
  background: #666;
}

.team-match-row--win .team-match-tree__node {
  background: #69dc7d;
}

.team-match-row--loss .team-match-tree__node {
  background: #ff6868;
}

.team-match-row--review .team-match-tree__node {
  background: #ffdf00;
}

.team-match-row--upcoming .team-match-tree__node {
  background: #65a8ff;
}

.team-match-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.team-match-card__top,
.team-match-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-match-card__top>div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-match-card__top span {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.team-match-card__top small {
  color: rgba(255, 255, 255, 0.46);
}

.team-match-result {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.team-match-result--win {
  background: rgba(105, 220, 125, 0.12);
  color: #8bea9a;
}

.team-match-result--loss {
  background: rgba(255, 104, 104, 0.12);
  color: #ff8a8a;
}

.team-match-result--upcoming {
  background: rgba(101, 168, 255, 0.12);
  color: #8cbfff;
}

.team-match-result--review,
.team-match-result--pending,
.team-match-result--bye {
  background: rgba(255, 223, 0, 0.1);
  color: #ffdf00;
}

.team-match-versus {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 14px 0;
}

.team-match-side {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.team-match-side--opponent {
  justify-content: flex-end;
  text-align: right;
}

.team-match-side img,
.team-match-logo-fallback {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.team-match-side img {
  object-fit: cover;
}

.team-match-logo-fallback {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 223, 0, 0.25);
  background: rgba(255, 223, 0, 0.06);
  color: #ffdf00;
  font-size: 0.72rem;
  font-weight: 900;
}

.team-match-side strong {
  overflow: hidden;
  color: #fff;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-match-score {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  gap: 7px;
  color: rgba(255, 255, 255, 0.5);
}

.team-match-score strong {
  color: #ffdf00;
  font-size: 1.25rem;
  font-weight: 950;
}

.team-match-card__footer {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.team-match-card__footer span {
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.7rem;
}

.team-match-card__footer a,
.team-tournament-footer a {
  color: #ffdf00;
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: none;
}

.team-tournament-footer {
  padding: 11px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  text-align: right;
}

.team-match-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.team-match-empty>i {
  color: #ffdf00;
  font-size: 2rem;
}

.team-match-empty h3,
.team-match-empty p {
  margin: 0;
}

.team-match-empty p {
  max-width: 460px;
  color: rgba(255, 255, 255, 0.55);
}

/* Centre the match stage and match number */
.team-match-card__top {
  position: relative;
  justify-content: center;
  min-height: 28px;
  padding-right: 68px;
  padding-left: 68px;
}

.team-match-card__top>div {
  justify-content: center;
  text-align: center;
}

.team-match-card__top .team-match-result {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

/* Prevent overlap on narrow phones */
@media (max-width: 480px) {
  .team-match-card__top {
    display: grid;
    grid-template-columns: 1fr auto;
    justify-content: initial;
    padding: 0;
  }

  .team-match-card__top>div {
    justify-content: flex-start;
    text-align: left;
  }

  .team-match-card__top .team-match-result {
    position: static;
    transform: none;
  }
}


/* =========================================
   Denser desktop tournament history
   ========================================= */

@media (min-width: 1050px) {
  .team-tournament-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  /* A single tournament still uses full width */
  .team-tournament-group:only-child {
    grid-column: 1 / -1;
  }

  .team-tournament-summary {
    min-height: 72px;
    padding: 12px 14px;
  }

  .team-tournament-summary__icon {
    width: 40px;
    height: 40px;
  }

  .team-match-tree {
    gap: 8px;
    padding: 2px 12px 12px 38px;
  }

  .team-match-tree::before {
    left: 21px;
  }

  .team-match-tree__node {
    top: 21px;
    left: -24px;
    width: 14px;
    height: 14px;
  }

  .team-match-card {
    padding: 10px 11px;
  }

  .team-match-versus {
    gap: 8px;
    margin: 10px 0;
  }

  .team-match-side img,
  .team-match-logo-fallback {
    width: 34px;
    height: 34px;
  }

  .team-match-side strong {
    font-size: 0.78rem;
  }

  .team-match-score {
    min-width: 48px;
  }

  .team-match-score strong {
    font-size: 1.05rem;
  }

  .team-match-card__footer {
    padding-top: 8px;
  }

  .team-tournament-footer {
    padding: 9px 13px;
  }
}

/* Give result cards more visual structure */
.team-match-row--win .team-match-card {
  border-left: 3px solid rgba(105, 220, 125, 0.7);
}

.team-match-row--loss .team-match-card {
  border-left: 3px solid rgba(255, 104, 104, 0.7);
}

.team-match-row--review .team-match-card {
  border-left: 3px solid rgba(255, 223, 0, 0.7);
}

.team-match-row--upcoming .team-match-card {
  border-left: 3px solid rgba(101, 168, 255, 0.7);
}

/* Return to one column on tablets and phones */
@media (max-width: 1049.98px) {
  .team-tournament-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Mobile
   ========================================= */

@media (max-width: 600px) {
  .team-match-history__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .team-tournament-summary {
    padding: 12px;
  }

  .team-tournament-summary__icon {
    width: 38px;
    height: 38px;
  }

  .team-tournament-summary__record span {
    display: none;
  }

  .team-match-tree {
    padding: 4px 10px 12px 29px;
  }

  .team-match-tree::before {
    left: 15px;
  }

  .team-match-tree__node {
    left: -21px;
  }

  .team-match-card {
    padding: 10px;
  }

  .team-match-versus {
    gap: 6px;
  }

  .team-match-side {
    align-items: center;
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }

  .team-match-side--opponent {
    flex-direction: column-reverse;
  }

  .team-match-side img,
  .team-match-logo-fallback {
    width: 34px;
    height: 34px;
  }

  .team-match-side strong {
    width: 100%;
    max-width: 105px;
    font-size: 0.72rem;
  }

  .team-match-score {
    min-width: 50px;
    gap: 4px;
  }

  .team-match-score strong {
    font-size: 1rem;
  }

  .team-match-card__footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}