:root {
  --team-card-height: 150px;

  --team-avatar-height-scale: 1;
  --team-avatar-width-scale: 1;

  --team-name-height-scale: 0.3;

  --score-boxes-height-scale: 0.3;
  --score-box-width: 100px;
  --stage-logo-width: 38px;

  --details-btn-width: 50px;

  --main-player-avatar-height-scale: 0.5;

  --players-box-width: calc(100% - var(--details-btn-width) - calc(var(--team-card-height) * var(--team-avatar-width-scale)));
  --players-main-width-scale: 0.8;
  --players-sub-width-scale: calc(1 - var(--players-main-width-scale));
}

/* 'Expand All' button */
.btn.btn-custom {
  background-color: var(--secondary-light2);
  color: var(--text);
  border: none;
  border-radius: var(--border-radius-sm);
  height: 32px;
  width: auto;
  padding: 0 12px;
  font-size: 0.875rem;
  cursor: pointer;
  box-shadow: 0 .125rem .5625rem -0.125rem rgba(0,0,0,.6);
  transition: background 0.2s ease;
}
.btn.btn-custom:hover {
  background-color: var(--accent);
  text-decoration: none;
}


/* === Division Separator Line === */
.division-separator {
  display: flex;
  flex-direction: row;
  border-bottom: 2px solid var(--accent);
  width: 100%;

  padding-inline: 10px;
  margin-top: 8px;
}

/* === Team Card Styles === */
.team-card {
  display: flex;
  flex-direction: column;
  
  width: 100%;

  height: auto;
  position: relative;
  margin: 8px auto 0px auto;
  padding: 8px;
  background-color: var(--background-dark1);
  color: var(--text);

  border: var(--border) 1px solid;
  border-radius: var(--border-radius);
  box-shadow: 0 .125rem .5625rem -0.125rem rgba(0,0,0,.6);

  font-size: 1rem;
}

.team-card-visible {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--team-card-height);
}

.team-card-body {
  display: flex;
  flex-direction: row;
  align-items: stretch;

  height: 100%;
  width: 100%;
  position: relative;
}

/* === Team avatar styling === */
.team-card-body .team-avatar {
  display: flex;
  align-items: center;
  justify-content: center;

  height: calc(var(--team-card-height) * var(--team-avatar-height-scale));
  width: calc(var(--team-card-height) * var(--team-avatar-width-scale));

  position: absolute;
  left: 0;
  top: 0;
}
.team-card-body .team-avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  object-fit: contain;
}


/* === Team name styling === */
.team-card-name {
  display: flex;
  align-items: center;

  height: calc(var(--team-card-height) * var(--team-name-height-scale));
  width: max-content;
  max-width: calc(100% - (var(--team-card-height) * var(--team-avatar-width-scale)) - var(--details-btn-width) - 80px);

  position: absolute;
  top: 0;
  left: calc(var(--team-card-height) * var(--team-avatar-width-scale));

  padding-inline: 10px;

  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary);

  white-space: nowrap;
}
.team-link {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-link:hover {
  text-decoration: underline;
  color: var(--accent);
}


/* === Score boxes styling === */
.score-boxes {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  
  gap: 2px;
  padding-inline: 5px;
  padding-block-end: 5px;

  height: calc(var(--team-card-height) * var(--score-boxes-height-scale));
  width: max-content;

  position: absolute;
  top: 0;
  right: calc(var(--details-btn-width));
}
.stage-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  width: fit-content;
  height: 100%;

  border: 2px solid var(--secondary-light3);
  border-radius: var(--border-radius-sm);

  z-index: 1;
  cursor: default;
  background-color: transparent;
  color: var(--text);
  transition: background-color 0.3s ease;
}
.stage-logo {
  display: flex;
  align-items: center;
  justify-content: center;

  height: 100%;
}
.stage-logo img {
  width: auto;
  height: 100%;
  object-fit: contain;

  filter: var(--logo-filter);
}
.stage-score {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text);

  width: max-content;
  height: 100%;

  gap: 2px;
  padding-right: 8px;
}


/* === Main players styling === */
.main-players-box {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;

  height: calc(var(--team-card-height) * (1 - var(--team-name-height-scale)));
  width: calc(var(--players-box-width) * var(--players-main-width-scale));

  position: absolute;
  bottom: 0;
  left: calc(var(--team-card-height) * var(--team-avatar-width-scale));

  overflow: hidden;
}
.main-player {
  display: flex;
  flex-direction: column;
  align-items: center;

  height: 100%;
}
.main-player:hover strong {
  text-decoration: underline;
}
.main-player-avatar {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: calc(100% * var(--main-player-avatar-height-scale));

  margin-top: 5px;

  position: relative;
}
.main-player-avatar img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  max-width: 100%;
}
.main-player-name {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  text-align: center;
  padding-inline: 5px;
}
.main-player-name strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
}
.main-player-name img {
  width: clamp(14px, 2vw, 18px);
  height: clamp(10px, 1.5vw, 12px);
  object-fit: contain;
}


/* === Sub player styling === */
.sub-players-box {
  display: flex;
  flex-direction: column;

  overflow-x: hidden;
  overflow-y: auto;
  height: calc(var(--team-card-height) * (1 - var(--score-boxes-height-scale)));
  width: calc(var(--players-box-width) * var(--players-sub-width-scale));
  
  border-left: 1px solid var(--secondary-light2);

  padding-inline: 8px;

  position: absolute;
  bottom: 0;
  right: calc(var(--details-btn-width));
}
.sub-players-box > a {
  display: block;
  width: 100%;
  min-width: 0;

  overflow: hidden;

  height: auto;
  flex: 0 0 auto;
}
.sub-player {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;

  min-width: 0;
  width: 100%;

  overflow: hidden;
  gap: 2px;
}
.sub-player:hover span {
  text-decoration: underline;
}
.sub-player span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  font-style: italic;
}
.sub-player img {
  width: clamp(14px, 2vw, 18px);
  height: clamp(10px, 1.5vw, 12px);
  object-fit: contain;
}


/* === Details button styling === */
.details-btn {
  display: flex;
  align-items: center;
  justify-content: center;

  height: 100%;
  width: var(--details-btn-width);

  background-color: var(--secondary-light2);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);

  padding: 10px;

  color: var(--text);

  position: absolute;
  top: 0;
  right: 0;

  transition: background-color 0.3s ease, transform 0.1s ease;
}
.details-btn:hover {
  background-color: var(--accent);
}
.details-btn:active {
  scale: 0.95;
}


@media screen and (max-width: 992px) {
  :root {
    --players-main-width-scale: 1;
  }

  .sub-players-box {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  :root {
    --team-card-height: 100px;

    --team-avatar-height-scale: 0.6;
    --team-avatar-width-scale: 0.6;

    --team-name-height-scale: 0.6;

    --details-btn-width: 35px;

    --score-boxes-height-scale: 0.6;
  }
  /* === Team avatar styling === */
  .team-card-body .team-avatar img {
    width: 85%;
    height: 85%;
    border-radius: var(--border-radius-sm);
  }

  /* === Team name styling === */
  .team-card-name {
    font-size: 1rem;
    padding-inline: 5px;
  }

  /* === Score box styling === */
  .score-boxes {
    flex-direction: column;
    align-items: flex-end;
  }
  .stage-box {
    height: 50%;
  }
  .stage-score {
    font-size: .8rem;
    font-weight: bold;
    gap: 2px;
    padding-right: 8px;
  }

  /* === Players styling === */
  .main-players-box {
    gap: 5px;

    height: calc(var(--team-card-height) * (1 - var(--team-avatar-height-scale)));
    width: calc(100% - var(--details-btn-width));

    bottom: 0;
    left: 0;
  }
  .main-player-avatar {
    display: none;
  }
  .main-player-name strong {
    font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  }
}