/* Tennison — Залславы (p9, v2 shell)
   Принцип: сайт светлый везде — престиж даём золотом/медалями и деталями,
   а не тёмными поверхностями на весь блок. */
.p9-legend-page {
  --p9-accent: #B7E000;
  --p9-accent-soft: #F5FBEA;
  --p9-accent-dark: #6B8E00;
  --p9-card: #FFFFFF;
  --p9-text: #1F1F1F;
  --p9-secondary: #6F6F6F;
  --p9-border: rgba(31, 31, 31, 0.08);
  --p9-radius: 14px;

  /* Тёмный — только для мелких акцентов (бейджи, шапки-полоски), не для целых блоков */
  --p9-dark: #1F1F1F;
  --p9-dark-soft: rgba(31, 31, 31, 0.05);

  --p9-gold: #C8960C;
  --p9-gold-dark: #9A7209;
  --p9-gold-soft: #FFF8E8;
  --p9-gold-border: rgba(200, 150, 12, 0.35);
  --p9-silver: #8A9099;
  --p9-silver-soft: #F2F3F4;
  --p9-bronze: #B07A46;
  --p9-bronze-soft: #FBF1E8;
}

.p9-legend-page *,
.p9-legend-page *::before,
.p9-legend-page *::after {
  box-sizing: border-box;
}

.p9-legend-page.mainV2__page--inner {
  padding-left: 0;
  padding-right: 0;
  max-width: none;
}

body.v2-page .p9-legend-page.mainV2__page--inner {
  padding-top: 4px;
}

@media (min-width: 991px) {
  body.v2-page .p9-legend-page.mainV2__page--inner {
    padding-top: 64px;
  }
}

.p9-legend-page .p9-wrap {
  max-width: var(--mv2-max-width, 1280px);
  margin: 0 auto;
  padding: 0 16px 88px;
}

@media (min-width: 991px) {
  .p9-legend-page .p9-wrap {
    padding-bottom: 40px;
  }
}

/* ================================================================
   HERO — светлая карточка, престиж через золото, не через чёрный фон
================================================================ */
.p9-legend-hero {
  position: relative;
  background:
    radial-gradient(circle at 100% 0%, rgba(200, 150, 12, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, #FFFDF6 0%, var(--p9-card) 60%);
  border: 1px solid var(--p9-gold-border);
  border-radius: var(--p9-radius);
  padding: 20px 18px;
  margin-bottom: 12px;
  overflow: hidden;
}

.p9-legend-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--p9-gold-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--p9-gold-dark);
}

.p9-legend-hero__eyebrow i {
  font-size: 13px;
  color: var(--p9-gold);
}

.p9-legend-hero__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--p9-text);
}

.p9-legend-hero__rule {
  width: 46px;
  height: 3px;
  margin: 0 0 12px;
  background: linear-gradient(90deg, var(--p9-gold) 0%, var(--p9-gold-soft) 100%);
  border: none;
  border-radius: 2px;
}

.p9-legend-hero__sub {
  margin: 0 0 16px;
  max-width: 520px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--p9-secondary);
}

.p9-legend-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.p9-legend-hero__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p9-legend-hero__stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--p9-text);
  line-height: 1;
}

.p9-legend-hero__stat-label {
  font-size: 11px;
  color: var(--p9-secondary);
}

@media (min-width: 991px) {
  .p9-legend-hero {
    padding: 30px 32px;
    margin-bottom: 16px;
  }

  .p9-legend-hero__title {
    font-size: 30px;
  }

  .p9-legend-hero__sub {
    font-size: 14px;
  }
}

/* ================================================================
   STICKY TOOLBAR — светлый бар, как остальные фильтры сайта
================================================================ */
.p9-legend-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0 -16px 16px;
  padding: 8px 16px 10px;
  background: rgba(244, 245, 246, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 0.5px solid var(--p9-border);
}

@media (min-width: 991px) {
  .p9-legend-toolbar {
    top: var(--mv2-topbar-h, 60px);
    margin-left: 0;
    margin-right: 0;
    padding: 10px 0;
    border-radius: 0;
  }
}

.p9-legend-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 8px;
  padding-bottom: 2px;
}

@media (min-width: 991px) {
  .p9-legend-nav {
    margin-bottom: 0;
    flex: 1;
  }
}

.p9-legend-nav::-webkit-scrollbar {
  display: none;
}

.p9-legend-nav__chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 0.5px solid var(--p9-border);
  background: var(--p9-card);
  color: var(--p9-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.p9-legend-nav__chip:hover {
  color: var(--p9-gold-dark);
  text-decoration: none;
}

.p9-legend-nav__chip.is-active {
  background: var(--p9-gold-soft);
  border-color: var(--p9-gold-border);
  color: var(--p9-gold-dark);
}

.p9-legend-season {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p9-legend-season__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--p9-secondary);
  white-space: nowrap;
}

.p9-legend-season__select {
  flex: 1;
  min-width: 0;
  max-width: 280px;
}

body.v2-page .p9-legend-page .p9-legend-season__select select {
  width: 100%;
  background: var(--p9-card);
  border: 0.5px solid var(--p9-border);
  color: var(--p9-text);
  border-radius: 999px;
  padding: 6px 28px 6px 14px;
  font-size: 13px;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236F6F6F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ================================================================
   SECTIONS
================================================================ */
.p9-legend-section {
  scroll-margin-top: 120px;
  margin-bottom: 30px;
}

.p9-legend-section__title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--p9-text);
}

@media (min-width: 991px) {
  .p9-legend-section__title {
    font-size: 20px;
    margin-bottom: 16px;
  }
}

/* ================================================================
   ЛЕГЕНДЫ — светлые карточки, медаль у топ-3
================================================================ */
.p9-legend-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .p9-legend-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 991px) {
  .p9-legend-cards {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

.p9-legend-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--p9-card);
  border: 0.5px solid var(--p9-border);
  border-radius: var(--p9-radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.p9-legend-card:hover {
  text-decoration: none;
  border-color: var(--p9-gold-border);
}

.p9-legend-card__crown {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 16px;
  color: var(--p9-gold);
}

.p9-legend-card__badge {
  display: inline-block;
  align-self: flex-start;
  margin-bottom: 12px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--p9-dark-soft);
  color: var(--p9-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.p9-legend-card__badge-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--p9-secondary);
}

.p9-legend-card__avatar {
  position: relative;
  align-self: center;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 50%;
  background: var(--p9-dark-soft);
}

.p9-legend-card__avatar .gamesTable__userProfileAvatar {
  width: 76px;
  height: 76px;
}

.p9-legend-card__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.p9-legend-card__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--p9-text);
}

.p9-legend-card__score {
  text-align: center;
}

.p9-legend-card__score-label {
  font-size: 9px;
  color: var(--p9-secondary);
  line-height: 1.2;
}

.p9-legend-card__score-value {
  display: inline-block;
  min-width: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--p9-dark-soft);
  color: var(--p9-text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

/* Топ-3 легенды — тёплая подсветка + медаль у аватара, без тёмного фона */
.p9-legend-card--top1,
.p9-legend-card--top2,
.p9-legend-card--top3 {
  background: var(--p9-gold-soft);
}

.p9-legend-card--top1 {
  border-color: var(--p9-gold-border);
}

.p9-legend-card--top1 .p9-legend-card__avatar {
  background: linear-gradient(135deg, var(--p9-gold) 0%, #E9C765 100%);
}

.p9-legend-card--top1 .p9-legend-card__score-value {
  background: var(--p9-gold);
  color: #fff;
}

.p9-legend-card--top2 {
  background: var(--p9-silver-soft);
  border-color: rgba(138, 144, 153, 0.35);
}

.p9-legend-card--top2 .p9-legend-card__avatar {
  background: linear-gradient(135deg, #B8BEC6 0%, var(--p9-silver) 100%);
}

.p9-legend-card--top2 .p9-legend-card__score-value {
  background: var(--p9-silver);
  color: #fff;
}

.p9-legend-card--top3 {
  background: var(--p9-bronze-soft);
  border-color: rgba(176, 122, 70, 0.35);
}

.p9-legend-card--top3 .p9-legend-card__avatar {
  background: linear-gradient(135deg, #C99B6E 0%, var(--p9-bronze) 100%);
}

.p9-legend-card--top3 .p9-legend-card__score-value {
  background: var(--p9-bronze);
  color: #fff;
}

/* ================================================================
   ПОБЕДИТЕЛИ СЕЗОНА — светлые списки, топ-3 медаль (как на /rating/)
================================================================ */
.p9-legend-cat {
  margin-bottom: 16px;
}

.p9-legend-cat__title {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--p9-accent-soft);
  color: var(--p9-accent-dark);
  font-size: 14px;
  font-weight: 700;
}

.p9-legend-list {
  background: var(--p9-card);
  border: 0.5px solid var(--p9-border);
  border-radius: var(--p9-radius);
  overflow: hidden;
}

.p9-legend-list__row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--p9-border);
  text-decoration: none;
  color: inherit;
}

.p9-legend-list__row:last-child {
  border-bottom: none;
}

.p9-legend-list__row:hover {
  background: var(--p9-accent-soft);
  text-decoration: none;
}

.p9-legend-list__row--top1,
.p9-legend-list__row--top2,
.p9-legend-list__row--top3 {
  background: var(--p9-gold-soft);
}

.p9-legend-list__row--top1:hover,
.p9-legend-list__row--top2:hover,
.p9-legend-list__row--top3:hover {
  background: #FFF1D2;
}

.p9-legend-list__pos {
  font-size: 18px;
  font-weight: 800;
  color: var(--p9-accent-dark);
  text-align: center;
}

.p9-legend-list__pos--top1 { color: var(--p9-gold); }
.p9-legend-list__pos--top2 { color: var(--p9-silver); }
.p9-legend-list__pos--top3 { color: var(--p9-bronze); }

.p9-legend-list__user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.p9-legend-list__user .gamesTable__userProfileAvatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.p9-legend-list__row--top1 .p9-legend-list__user .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-gold);
  border-radius: 50%;
}

.p9-legend-list__row--top2 .p9-legend-list__user .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-silver);
  border-radius: 50%;
}

.p9-legend-list__row--top3 .p9-legend-list__user .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-bronze);
  border-radius: 50%;
}

.p9-legend-list__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--p9-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p9-legend-list__stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--p9-secondary);
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .p9-legend-list__row {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .p9-legend-list__stats {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    text-align: left;
  }
}

/* ================================================================
   ИТОГОВЫЕ / СЕРИЙНЫЕ — светлые карточки, тёмная лишь узкая шапка
================================================================ */
.p9-legend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .p9-legend-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 991px) {
  .p9-legend-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.p9-legend-tourney {
  background: var(--p9-card);
  border: 0.5px solid var(--p9-border);
  border-radius: var(--p9-radius);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.p9-legend-tourney__head {
  display: block;
  padding: 10px 14px;
  background: var(--p9-dark);
  color: var(--p9-gold-soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.p9-legend-tourney__head:hover {
  color: #fff;
  text-decoration: none;
}

.p9-legend-tourney__body {
  padding: 4px 0;
}

.p9-legend-tourney__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 0.5px solid var(--p9-border);
  text-decoration: none;
  color: inherit;
}

.p9-legend-tourney__row:last-child {
  border-bottom: none;
}

.p9-legend-tourney__row:hover {
  background: var(--p9-accent-soft);
  text-decoration: none;
}

.p9-legend-tourney__pos {
  width: 26px;
  font-size: 19px;
  font-weight: 800;
  color: var(--p9-secondary);
  text-align: center;
}

.p9-legend-tourney__row--pos1 .p9-legend-tourney__pos { color: var(--p9-gold); }
.p9-legend-tourney__row--pos2 .p9-legend-tourney__pos { color: var(--p9-silver); }
.p9-legend-tourney__row--pos3 .p9-legend-tourney__pos { color: var(--p9-bronze); }

.p9-legend-tourney__row .gamesTable__userProfileAvatar {
  width: 30px;
  height: 30px;
}

.p9-legend-tourney__row--pos1 .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-gold);
  border-radius: 50%;
}

.p9-legend-tourney__row--pos2 .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-silver);
  border-radius: 50%;
}

.p9-legend-tourney__row--pos3 .gamesTable__userProfileAvatar {
  box-shadow: 0 0 0 2px var(--p9-bronze);
  border-radius: 50%;
}

.p9-legend-tourney__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--p9-text);
}

/* Карточка турнира — тонкая золотая рамка (трофейная витрина, но светлая) */
.p9-legend-tourney--champion {
  border-color: var(--p9-gold-border);
  box-shadow: 0 0 0 1px rgba(200, 150, 12, 0.18), 0 4px 14px rgba(200, 150, 12, 0.08);
}

/* Series */
.p9-legend-series-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--p9-accent-soft);
  color: var(--p9-accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.p9-legend-series-label:first-child {
  margin-top: 0;
}

.p9-legend-series {
  margin-bottom: 8px;
}

/* ================================================================
   НОМИНАЦИИ — светлая карточка с золотым свечением
================================================================ */
.p9-legend-noms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .p9-legend-noms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 991px) {
  .p9-legend-noms {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.p9-legend-nom {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px;
  background: var(--p9-card);
  border-radius: var(--p9-radius);
  text-align: center;
  box-shadow: 0 0 0 1px rgba(200, 150, 12, 0.2), 0 6px 16px rgba(200, 150, 12, 0.08);
}

.p9-legend-nom__head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
  text-align: left;
}

.p9-legend-nom__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--p9-text);
}

.p9-legend-nom__season {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--p9-gold-soft);
  color: var(--p9-gold-dark);
  font-size: 10px;
  font-weight: 700;
}

.p9-legend-nom__avatar {
  margin-bottom: 10px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--p9-gold) 0%, #E9C765 100%);
  text-decoration: none;
}

.p9-legend-nom__avatar .gamesTable__userProfileAvatar {
  width: 90px;
  height: 90px;
}

.p9-legend-nom__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--p9-text);
  text-decoration: none;
}

.p9-legend-nom__name:hover {
  color: var(--p9-gold-dark);
  text-decoration: none;
}

/* ================================================================
   Комментарии
================================================================ */
.p9-legend-comments {
  margin-top: 8px;
}

.p9-legend-comments .content-box,
.p9-legend-comments .commentsBox {
  background: var(--p9-card) !important;
  border: 0.5px solid var(--p9-border) !important;
  border-radius: var(--p9-radius) !important;
}

body.v2-page .p9-legend-page a {
  color: inherit;
}
