/* ==========================================================================
   Tournaments page
   ========================================================================== */

.tournaments-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.875rem;
  width: 100%;
}

.tournaments-page__title {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0;
}

.tournaments-page__title-icon {
  flex-shrink: 0;
  width: 2.4375rem;
  height: 2.4375rem;
  object-fit: contain;
}

.tournaments-page__title-text {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  line-height: normal;
  color: var(--color-text);
}

.tournaments-board {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
  width: 100%;
}

.tournaments-board__bank-info {
  margin: 0;
  font-size: var(--font-sm);
  font-weight: 400;
  line-height: 1.35;
  color: var(--color-text-muted);
}

.tournaments-board__bank-info b {
  color: var(--color-text);
  font-weight: 500;
}

.tournament-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: auto;
  aspect-ratio: 1547 / 198;
  min-height: 0;
  padding: var(--tournament-banner-padding);
  border: 0.125rem solid var(--color-accent);
  border-radius: 0.9375rem;
  background: #0c0b0e;
  overflow: hidden;
}

.tournament-banner__bg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% center;
  pointer-events: none;
  user-select: none;
}

.tournament-banner__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(12, 11, 14, 0.78) 0%,
    rgba(12, 11, 14, 0.42) 34%,
    rgba(12, 11, 14, 0.08) 58%,
    transparent 78%
  );
  pointer-events: none;
  z-index: 1;
}

.tournament-banner__pattern,
.tournament-banner__art,
.tournament-banner__blur {
  display: none;
}

.tournament-banner__body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.tournament-banner__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.tournament-banner__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3125rem;
}

.tournament-banner__name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: normal;
  color: var(--color-text);
  text-shadow: 0 0.125rem 0.75rem rgba(0, 0, 0, 0.45);
}

.tournament-banner__subtitle {
  margin: 0;
  font-size: var(--font-md);
  font-weight: 400;
  line-height: normal;
  color: var(--color-text-muted);
  text-shadow: 0 0.0625rem 0.5rem rgba(0, 0, 0, 0.4);
}

.tournament-banner__prize {
  margin: 0;
  font-size: var(--font-md);
  font-weight: 500;
  line-height: normal;
  color: var(--color-accent);
  text-shadow: 0 0.0625rem 0.5rem rgba(0, 0, 0, 0.35);
}

.tournament-banner__footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.625rem;
  width: 100%;
  flex-shrink: 0;
  margin-top: auto;
}

.tournament-banner__timer-wrap {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.tournament-banner__timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.3125rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  font-size: var(--font-xs);
  font-weight: 500;
  line-height: 0.9375rem;
  letter-spacing: -0.0375rem;
  color: var(--color-text);
  white-space: nowrap;
}

.tournament-banner__timer-info {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.1875rem;
  height: 1.1875rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: var(--transition-base);
}

.tournament-banner__timer-info img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tournament-banner__timer-info:hover {
  opacity: 0.85;
}

.tournament-banner__timer-info:focus-visible {
  outline: 0.125rem solid var(--color-accent);
  outline-offset: 0.125rem;
  border-radius: 50%;
}

.tournament-banner__timer-tooltip {
  position: absolute;
  bottom: calc(100% + 0.4375rem);
  left: 0;
  z-index: 3;
  width: min(17.5rem, calc(100vw - 3rem));
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  background: var(--color-auth-tooltip);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.125rem;
  color: var(--color-text);
  text-align: left;
  white-space: normal;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.35);
}

.tournament-banner__timer-tooltip[hidden] {
  display: none;
}

.tournament-banner__timer-tooltip::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  bottom: -0.375rem;
  width: 0;
  height: 0;
  border-left: 0.375rem solid transparent;
  border-right: 0.375rem solid transparent;
  border-top: 0.375rem solid var(--color-auth-tooltip);
}

.tournament-banner__timer-tooltip b {
  font-weight: 600;
  color: var(--color-text);
}

.tournament-stats {
  display: grid;
  grid-template-columns: 27.925fr 38.462fr 27.795fr;
  gap: 1.25rem;
  width: 100%;
}

.tournament-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  min-height: 4.8125rem;
  padding: 1rem 1.25rem;
  border-radius: 0.9375rem;
  background: var(--color-surface);
}

.tournament-stat__label {
  margin: 0;
  font-size: var(--font-sm);
  font-weight: 500;
  line-height: normal;
  color: var(--color-text-muted);
  text-align: center;
}

.tournament-stat__value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: normal;
  color: var(--color-text);
  text-align: center;
}

.tournament-leaderboard {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.tournament-leaderboard__head {
  display: grid;
  grid-template-columns: 2.5rem 1fr 1fr 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 0.9375rem 0.9375rem 0 0;
  background: var(--color-surface);
  font-size: var(--font-md);
  font-weight: 500;
  line-height: normal;
  color: var(--color-text-muted);
}

.tournament-leaderboard__head .tournament-leaderboard__col {
  min-width: 0;
}

.tournament-leaderboard__head .tournament-leaderboard__col:nth-child(2),
.tournament-leaderboard__head .tournament-leaderboard__col:nth-child(3) {
  justify-self: center;
  text-align: center;
}

.tournament-leaderboard__head .tournament-leaderboard__col:nth-child(4) {
  justify-self: end;
  text-align: right;
}

.tournament-leaderboard__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.9375rem;
  border-radius: 0 0 0.9375rem 0.9375rem;
  background: var(--color-tournament-row-bg);
}

.tournaments-page--has-leaders .tournament-leaderboard__empty {
  display: none;
}

.tournament-leaderboard__empty-text {
  margin: 0;
  font-size: var(--font-sm);
  font-weight: 400;
  line-height: normal;
  color: var(--color-tournament-empty-text);
}

.tournament-leaderboard__list {
  display: none;
  flex-direction: column;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tournaments-page--has-leaders .tournament-leaderboard__list {
  display: flex;
}

.tournament-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 1fr 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.9375rem;
  background: var(--color-tournament-row-bg);
  transition: background 0.2s ease-in-out;
}

.tournament-leaderboard__list .tournament-row:first-child {
  border-radius: 0 0 0.9375rem 0.9375rem;
}

.tournament-row--self {
  background: var(--gradient-tournament-user-row);
}

.tournament-row__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.5rem;
  border-radius: 0.9375rem;
  background: var(--color-surface);
  box-shadow: var(--shadow-rank-default);
  font-size: var(--font-sm);
  font-weight: 500;
  line-height: normal;
  color: var(--color-text);
}

.tournament-row__rank--gold {
  background: var(--color-rank-gold);
  box-shadow: var(--shadow-rank-gold);
  color: var(--color-text-dark);
  font-weight: 700;
}

.tournament-row__rank--silver {
  background: var(--color-rank-silver);
  box-shadow: var(--shadow-rank-silver);
  color: var(--color-text-dark);
  font-weight: 700;
}

.tournament-row__rank--bronze {
  background: var(--color-rank-bronze);
  box-shadow: var(--shadow-rank-bronze);
  color: var(--color-text-dark);
  font-weight: 700;
}

.tournament-row__rank--self {
  background: var(--color-accent);
  box-shadow: var(--shadow-rank-self);
  color: var(--color-text-dark);
  font-weight: 500;
}

.tournament-row__user,
.tournament-row__turnover {
  font-size: var(--font-md);
  font-weight: 500;
  line-height: normal;
  color: var(--color-text);
  min-width: 0;
  justify-self: center;
  text-align: center;
}

.tournament-row__user.user-open-profile {
  cursor: pointer;
}

.tournament-row__user.user-open-profile:hover {
  color: var(--color-accent);
}

.tournament-row__prize {
  font-size: var(--font-md);
  font-weight: 500;
  line-height: normal;
  color: var(--color-tournament-prize);
  justify-self: end;
  text-align: right;
  min-width: 0;
}

.tournament-row__prize--zero {
  color: var(--color-text);
}

@media (max-width: 64rem) {
  .tournament-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tournament-stat:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 48rem) {
  .tournaments-page {
    gap: 0.9375rem;
  }

  .tournaments-page__title {
    gap: 0.625rem;
  }

  .tournaments-page__title-icon {
    width: 2rem;
    height: 2rem;
  }

  .tournaments-page__title-text {
    font-size: 1rem;
    font-weight: 600;
    line-height: normal;
  }

  .tournaments-board {
    gap: 0.9375rem;
  }

  .tournaments-board__bank-info {
    display: none;
  }

  .tournament-banner {
    height: 12.375rem;
    min-height: 12.375rem;
    aspect-ratio: auto;
    padding: 0.9375rem;
    border-width: 1px;
    border-radius: 0.9375rem;
    overflow: hidden;
  }

  .tournament-banner__bg {
    object-position: 62% center;
  }

  .tournament-banner__shade {
    background: linear-gradient(
      90deg,
      rgba(12, 11, 14, 0.88) 0%,
      rgba(12, 11, 14, 0.55) 42%,
      rgba(12, 11, 14, 0.15) 68%,
      transparent 88%
    );
  }

  .tournament-banner__text {
    gap: 1.25rem;
  }

  .tournament-banner__intro {
    gap: 0.3125rem;
  }

  .tournament-banner__name {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: normal;
  }

  .tournament-banner__subtitle {
    font-size: 0.75rem;
    line-height: normal;
  }

  .tournament-banner__prize {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
    color: var(--color-accent);
  }

  .tournament-banner__footer {
    justify-content: flex-start;
  }

  .tournament-banner__timer {
    padding: 0.3125rem;
    border-radius: 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 0.9375rem;
    letter-spacing: -0.0375rem;
  }

  .tournament-stats {
    display: flex;
    flex-direction: column;
    gap: 0.9375rem;
    width: 100%;
  }

  .tournament-stat,
  .tournament-stat:last-child {
    grid-column: auto;
    min-height: 0;
    padding: 0.625rem 0.9375rem;
    border-radius: 0.625rem;
    gap: 0.3125rem;
  }

  .tournament-stat__label {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
    color: var(--color-text-muted);
  }

  .tournament-stat__value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: normal;
  }

  .tournament-leaderboard {
    overflow-x: visible;
    width: 100%;
  }

  .tournament-leaderboard__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.9375rem;
    border-radius: 0.9375rem 0.9375rem 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
  }

  .tournament-leaderboard__head .tournament-leaderboard__col {
    flex: 0 1 auto;
    min-width: 0;
    justify-self: auto;
    text-align: left;
  }

  .tournament-leaderboard__head .tournament-leaderboard__col:nth-child(2),
  .tournament-leaderboard__head .tournament-leaderboard__col:nth-child(3) {
    text-align: center;
  }

  .tournament-leaderboard__head .tournament-leaderboard__col:last-child {
    text-align: right;
  }

  .tournament-leaderboard__empty {
    min-height: 0;
    padding: 0.9375rem;
    border-radius: 0 0 0.9375rem 0.9375rem;
  }

  .tournament-leaderboard__empty-text {
    font-size: 0.875rem;
    font-weight: 400;
    line-height: normal;
    color: var(--color-tournament-empty-text);
  }

  .tournament-leaderboard__list {
    gap: 0.625rem;
  }

  .tournament-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.9375rem;
    border-radius: 0.9375rem;
  }

  .tournament-leaderboard__list .tournament-row:first-child {
    border-radius: 0 0 0.9375rem 0.9375rem;
  }

  .tournament-leaderboard__list .tournament-row:not(:first-child) {
    border-radius: 0.9375rem;
  }

  .tournament-row__rank {
    box-sizing: border-box;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    border-radius: 0.625rem;
    font-size: 0.625rem;
    font-weight: 500;
    line-height: normal;
  }

  .tournament-row__rank--gold,
  .tournament-row__rank--silver,
  .tournament-row__rank--bronze {
    font-weight: 700;
  }

  .tournament-row__rank--self {
    font-weight: 500;
  }

  .tournament-row__user,
  .tournament-row__turnover {
    flex: 0 1 auto;
    min-width: 0;
    justify-self: auto;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
  }

  .tournament-row__prize {
    flex: 0 1 auto;
    min-width: 0;
    justify-self: auto;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: normal;
    color: var(--color-tournament-prize);
  }

  .tournament-row__prize--zero {
    color: var(--color-text);
  }
}
