/* Shared player profile structure and competitive statistics.
   Used by account.html and player-profile.html. */

.ersi-profile-card {
  box-sizing: border-box;
  padding: clamp(24px, 2.5vw, 36px);
  border: 1px solid #30363d;
  border-radius: 16px;
  background: #0d1117;
}

.profile-summary-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(220px, 300px) minmax(360px, 1fr);
  gap: clamp(24px, 2.5vw, 38px);
  align-items: start;
}

.profile-image-area {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 8px 0;
  text-align: center;
}

.profile-avatar-shell {
  position: relative;
  display: grid;
  width: 192px;
  height: 192px;
  flex: 0 0 192px;
  place-items: center;
  overflow: hidden;
  border: 3px solid rgba(0, 212, 255, 0.55);
  border-radius: 50%;
  background: linear-gradient(145deg, #17202a, #0d1117);
  box-shadow: 0 0 0 6px rgba(0, 212, 255, 0.09);
}

.profile-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.profile-summary-content {
  display: contents;
}

.profile-identity-row {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-height: 0;
  text-align: center;
  align-self: center;
}

.profile-main-info {
  display: grid;
  min-width: 250px;
  flex: 1 1 auto;
  max-width: none;
  align-content: center;
  gap: 0;
  justify-items: center;
}

.profile-main-info h2 {
  margin: 0 0 16px;
  color: #fff;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.profile-player-public-id {
  margin: 0 0 15px;
  color: #8b949e;
  line-height: 1.4;
}

.profile-player-public-id strong {
  margin-inline-start: 5px;
  color: #fff;
}

.rank-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  justify-content: center;
}

.rank-badge {
  display: inline-flex;
  min-width: 62px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.rank-C,
.rank-Cminus,
.rank-Cplus {
  color: #c9d1d9;
  background: rgba(201, 209, 217, 0.1);
}

.rank-B,
.rank-Bminus,
.rank-Bplus {
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.12);
}

.rank-A,
.rank-Aminus,
.rank-Aplus {
  color: #ffc400;
  background: rgba(255, 196, 0, 0.12);
}

.rank-Pro {
  color: #f85149;
  background: rgba(248, 81, 73, 0.12);
}

.rank-unconfirmed {
  color: #8b949e;
  background: rgba(139, 148, 158, 0.1);
}

.ranking-status-text {
  color: #8b949e;
  font-size: 0.82rem;
  line-height: 1.35;
}

.profile-elo-panel {
  display: grid;
  box-sizing: border-box;
  flex: 0 1 230px;
  justify-items: start;
  gap: 9px;
  padding-inline-start: 0;
  border-inline-start: 0;
  text-align: start;
}

.profile-avatar-elo {
  width: 100%;
  flex: 0 0 auto;
  justify-items: center;
  padding-top: 18px;
  border-top: 1px solid #30363d;
  text-align: center;
}

.profile-avatar-elo .profile-elo-value-row {
  justify-content: center;
}

.elo-label {
  color: #8b949e;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-elo-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 12px;
}

.profile-elo-value-row strong {
  color: var(--primary);
  font-size: clamp(2.45rem, 4.5vw, 3.35rem);
  line-height: 0.9;
}

.elo-delta {
  padding-bottom: 5px;
  font-weight: 900;
  line-height: 1;
}

.elo-plus {
  color: #3fb950;
}

.elo-minus {
  color: #f85149;
}

.elo-neutral {
  color: #8b949e;
}

.player-statistics-section {
  min-width: 0;
}

.player-statistics-section h3 {
  margin: 0 0 18px;
  color: #fff;
  font-size: 1rem;
  line-height: 1.25;
}

.profile-game-statistics {
  margin: 0;
  align-self: center;
}

.profile-match-statistics {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid #30363d;
}

.player-game-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ersi-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.player-stat-box,
.ersi-stat-box {
  min-width: 0;
  padding: 15px;
  border: 1px solid #30363d;
  border-radius: 13px;
  background: #161b22;
}

.player-stat-label,
.ersi-stat-label {
  display: block;
  margin-bottom: 8px;
  color: #8b949e;
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.player-stat-box strong,
.ersi-stat-box strong {
  color: #fff;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.ersi-stat-box #profileLastEloChange.elo-plus {
  color: #3fb950;
}

.ersi-stat-box #profileLastEloChange.elo-minus {
  color: #f85149;
}

.ersi-stat-box #profileLastEloChange.elo-neutral {
  color: #8b949e;
}

.last-tournament-row {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  background: rgba(0, 212, 255, 0.06);
  color: #8b949e;
}

.last-tournament-row strong {
  margin-inline-start: 6px;
  color: #fff;
}

@media (max-width: 1100px) {
  .profile-summary-layout {
    grid-template-columns: minmax(200px, 230px) minmax(200px, 250px) minmax(300px, 1fr);
    gap: 32px;
  }

  .ersi-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 761px) and (max-width: 1050px) {
  .profile-summary-layout {
    grid-template-columns: minmax(200px, 230px) minmax(0, 1fr);
  }

  .profile-game-statistics {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .ersi-profile-card {
    padding: 22px;
  }

  .profile-summary-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .profile-summary-content {
    display: grid;
    min-width: 0;
    gap: 28px;
  }

  .profile-image-area {
    padding: 0;
  }

  .profile-avatar-shell {
    width: 164px;
    height: 164px;
    flex-basis: 164px;
  }

  .profile-identity-row {
    flex-direction: column;
    gap: 24px;
    min-height: 0;
    text-align: center;
  }

  .profile-main-info {
    min-width: 0;
    flex-basis: auto;
  }

  .rank-badge-row {
    justify-content: center;
  }

  .profile-match-statistics {
    margin-top: 30px;
    padding-top: 26px;
  }

  .player-game-stats-grid,
  .ersi-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .last-tournament-row {
    display: grid;
    gap: 5px;
    text-align: center;
  }

  .last-tournament-row strong {
    margin-inline-start: 0;
  }
}

@media (max-width: 430px) {
  .player-game-stats-grid,
  .ersi-stats-grid {
    grid-template-columns: 1fr;
  }
}

html[dir="rtl"] .ersi-profile-card,
html[dir="rtl"] .player-statistics-section,
html[dir="rtl"] .last-tournament-row {
  direction: rtl;
  text-align: right;
}

@media (max-width: 760px) {
  html[dir="rtl"] .profile-identity-row {
    text-align: center;
  }
}
