/* ==========================================================================
   Модалка профиля игрока (.profile-modal) — единая сетка.

   Раскладка (сверху вниз):
     ┌──────────────────────────────────────────┐
     │                              ⛶  •••  ✕  │  кнопки в углу
     │              [голова]                    │  шапка по центру
     │               Ник                        │
     │ Тиры                                     │  блок тиров на всю ширину
     │ [ слот ] [ слот ] [ слот ]               │
     │ ▸ История тиров                          │  раскрывающиеся секции
     │ ▸ История рестриктов                     │
     └──────────────────────────────────────────┘

   Отступы только из шкалы: 6 / 8 / 12 / 16 / 20 px.
   Файл подключается ПОСЛЕ остальных css и перекрывает их только внутри .profile-modal,
   поэтому полная страница /profile не затрагивается.
   ========================================================================== */

html body .profile-modal.mc-ui {
  --pm-pad: 20px;      /* поля окна */
  --pm-gap: 16px;      /* между крупными блоками */
  --pm-bar: 32px;      /* высота верхней полосы и кнопок */
  --pm-btn-gap: 6px;   /* между кнопками ⛶ ••• ✕ */
  --pm-toolbar-w: calc(var(--pm-bar) * 3 + var(--pm-btn-gap) * 2);

  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  padding: 56px var(--pm-pad) var(--pm-pad);   /* сверху место под кнопки ⛶ ••• ✕ */
}

/* ---------- Кнопки ⛶ ••• ✕: одинаковые квадраты в одной строке с верхней полосой ---------- */
html body .profile-modal.mc-ui .profile-modal-toolbar {
  position: absolute;
  top: var(--pm-pad);
  right: var(--pm-pad);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--pm-btn-gap);
  margin: 0;
}
html body .profile-modal.mc-ui .profile-modal-toolbar .modal-close,
html body .profile-modal.mc-ui .profile-menu--toolbar .profile-menu-btn {
  box-sizing: border-box;
  width: var(--pm-bar);
  height: var(--pm-bar);
  min-width: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html body .profile-modal.mc-ui .profile-menu--toolbar .profile-menu-btn { letter-spacing: -1px; }
html body .profile-modal.mc-ui .profile-menu--toolbar .profile-menu-list {
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 210px;
}

/* ---------- Шапка: большая голова по центру, под ней ник ---------- */
html body .profile-modal.mc-ui .profile-modal-head { display: block; margin: 0 0 var(--pm-gap); padding: 0; }
html body .profile-modal.mc-ui .profile-modal-identity {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
html body .profile-modal.mc-ui .profile-modal-identity .mc-frame { flex: none; }
html body .profile-modal.mc-ui .mc-frame .avatar-head.lg { width: 200px; height: 200px; }   /* ≈ половина карточки */
html body .profile-modal.mc-ui .profile-modal-info { flex: none; width: 100%; min-width: 0; }
html body .profile-modal.mc-ui .profile-identity-row { display: block; }
html body .profile-modal.mc-ui .profile-identity-text {
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; text-align: center;
}
html body .profile-modal.mc-ui .profile-modal-info h2 { margin: 0; font-size: 28px; line-height: 1.1; overflow-wrap: anywhere; }
html body .profile-modal.mc-ui .profile-badge-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0; }
html body .profile-modal.mc-ui .profile-badge-row .badge {
  box-sizing: border-box; display: inline-flex; align-items: center; height: 28px; margin: 0; padding: 0 12px; font-size: 16px; line-height: 1;
}

/* ---------- Блок тиров ---------- */
html body .profile-modal.mc-ui .profile-modal-tiers { margin: 0 0 var(--pm-gap); }
html body .profile-modal.mc-ui .profile-modal-tiers > .profile-modal-section-title {
  margin: 0 0 8px;
  padding: 0;
  background: none;
  box-shadow: none;
  cursor: default;
  color: var(--mc-text);
}
html body .profile-modal.mc-ui .tier-icon-grid {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--c-1c1c1c, #1c1c1c);
  box-shadow: var(--mc-slot);
}
html body .profile-modal.mc-ui .tier-icon-cell {
  width: auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
html body .profile-modal.mc-ui .tier-icon-badge {
  box-sizing: border-box;
  width: 56px;
  height: 56px;
  padding: 12px;
}
html body .profile-modal.mc-ui .tier-icon-cell .tier-icon-label { line-height: 1; }
/* плашка рестрикта — того же вида, что и панель тиров */
html body .profile-modal.mc-ui .profile-modal-tiers .rest-banner {
  margin: 0;
  padding: 12px 16px;
  gap: 4px;
}
html body .profile-modal.mc-ui .profile-modal-tiers .tier-icon-grid + .rest-banner,
html body .profile-modal.mc-ui .profile-modal-tiers #ppm-tiers + .rest-banner { margin-top: 8px; }

/* ---------- Раскрывающиеся секции: История тиров / История рестриктов ---------- */
html body .profile-modal.mc-ui .profile-modal-section-title[onclick] {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  font-size: 16px;
  line-height: 1;
  color: var(--mc-text);
  cursor: pointer;
  user-select: none;
}
html body .profile-modal.mc-ui .profile-modal-section-title[onclick] .chev {
  flex: none;
  width: 16px;
  font-size: 14px;
  line-height: 1;
  text-align: center;
}
html body .profile-modal.mc-ui .profile-modal-section-title[onclick] + .collapsible + .profile-modal-section-title[onclick] { margin-top: 8px; }
html body .profile-modal.mc-ui .collapsible.open,
html body .profile-modal.mc-ui .collapsible.tall.open {
  margin-top: 4px;
  background: var(--c-1c1c1c, #1c1c1c);
  box-shadow: var(--mc-slot);
}
html body .profile-modal.mc-ui .collapsible.open > * { padding-left: 0; padding-right: 0; }
/* отступы внутри — только в раскрытом виде, иначе закрытая секция не схлопывается до нуля */
html body .profile-modal.mc-ui .collapsible.open .loading-state { padding: 12px; }
html body .profile-modal.mc-ui .collapsible.open .muted { padding: 12px !important; }
html body .profile-modal.mc-ui .collapsible:not(.open) { background: none; }

/* История тиров: карточки */
html body .profile-modal.mc-ui .hcard-list {
  gap: 8px;
  padding: 8px;
  max-height: min(420px, 50vh);
}
html body .profile-modal.mc-ui .hcard { padding: 12px 12px 12px 16px; gap: 8px; }

/* История рестриктов: строки */
html body .profile-modal.mc-ui .restriction-history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px;
}
html body .profile-modal.mc-ui .restriction-history-row .rh-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
html body .profile-modal.mc-ui .restriction-history-row .rh-status { flex: none; padding: 4px 10px; line-height: 1; }
html body .profile-modal.mc-ui .restriction-history-row:last-child { border-bottom: 0; }

/* ---------- Телефоны ---------- */
@media (max-width: 560px) {
  html body .profile-modal.mc-ui { --pm-pad: 14px; --pm-gap: 14px; }
  html body .profile-modal.mc-ui .profile-modal-identity { gap: 14px; }
  html body .profile-modal.mc-ui .mc-frame .avatar-head.lg { width: 150px; height: 150px; }
  html body .profile-modal.mc-ui .profile-modal-info h2 { font-size: 22px; }
  html body .profile-modal.mc-ui .tier-icon-grid { padding: 12px; gap: 8px; }
  html body .profile-modal.mc-ui .hcard-top { flex-wrap: wrap; }
}

/* ==========================================================================
   ШИРОКОЕ ОКНО ПРОФИЛЯ — две колонки (перекрывает правила выше).

     ┌─────────────────────────────────────────────────────────────┐
     │ ┌───────────┐  Тиры                              ⛶  •••  ✕ │
     │ │  [голова] │  [ слот ] [ слот ] [ слот ]                   │
     │ │   Ник     │  ▸ История тиров                              │
     │ │  бейджи   │  ▸ История рестриктов                         │
     │ │ #3 место  │                                               │
     │ └───────────┘                                               │
     └─────────────────────────────────────────────────────────────┘

   Левая колонка липкая: при длинной истории справа карточка игрока остаётся на виду.
   Кнопки ⛶ ••• ✕ стоят в одной строке с заголовком «Тиры».
   ========================================================================== */
html body .profile-modal.mc-ui {
  max-width: 940px;
  width: min(940px, 96vw);
  padding: var(--pm-pad);
}
html body .profile-modal.mc-ui .pm-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--pm-gap);
  align-items: start;
}

/* ---------- Левая колонка: карточка игрока ---------- */
html body .profile-modal.mc-ui .pm-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--pm-pad) 16px;
  background: var(--c-1c1c1c, #1c1c1c);
  box-shadow: var(--mc-slot);
}
html body .profile-modal.mc-ui .pm-side .profile-modal-head { margin: 0; width: 100%; }
html body .profile-modal.mc-ui .pm-side .profile-modal-identity { gap: 16px; }
html body .profile-modal.mc-ui .pm-side .mc-frame .avatar-head.lg { width: 168px; height: 168px; }
html body .profile-modal.mc-ui .pm-side .profile-modal-info h2 { font-size: 24px; }
html body .profile-modal.mc-ui .pm-side .profile-identity-text { gap: 12px; }
html body .profile-modal.mc-ui .pm-side .profile-modal-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 12px 8px 0;
  text-align: center;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 2px solid var(--c-000000, #000);
}
html body .profile-modal.mc-ui .pm-side .profile-modal-rank .num { font-size: 26px; line-height: 1; font-style: normal; color: var(--c-ffffff, #fff); }

/* ---------- Правая колонка ---------- */
html body .profile-modal.mc-ui .pm-main { min-width: 0; }
html body .profile-modal.mc-ui .pm-main .profile-modal-tiers > .profile-modal-section-title {
  display: flex;
  align-items: center;
  height: var(--pm-bar);        /* та же строка, что и кнопки ⛶ ••• ✕ */
  margin: 0 0 12px;
  font-size: 22px;
}
html body .profile-modal.mc-ui .pm-main .tier-icon-grid {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 16px;
  padding: 20px 16px;
}
html body .profile-modal.mc-ui .pm-main .tier-icon-badge { width: 64px; height: 64px; padding: 14px; }
html body .profile-modal.mc-ui .pm-main .hcard-list { max-height: min(460px, 52vh); }

/* ---------- Узкие экраны: колонки друг под другом ---------- */
@media (max-width: 760px) {
  html body .profile-modal.mc-ui { padding-top: 56px; }
  html body .profile-modal.mc-ui .pm-layout { grid-template-columns: minmax(0, 1fr); }
  html body .profile-modal.mc-ui .pm-side { position: static; }
  html body .profile-modal.mc-ui .pm-side .mc-frame .avatar-head.lg { width: 150px; height: 150px; }
  html body .profile-modal.mc-ui .pm-main .profile-modal-tiers > .profile-modal-section-title { height: auto; }
}

/* ---------- Верхняя панель ⛶ ••• ✕ ----------
   Раньше .modal .modal-head (justify-content: space-between) разносил кнопки по краям окна.
   Теперь это компактная группа в правом углу: без рамок и фона, подсветка только при наведении. */
html body .profile-modal.mc-ui .profile-modal-toolbar {
  left: auto;
  width: auto;
  justify-content: flex-end;
  gap: 2px;
  top: 12px;
  right: 12px;
}
html body .profile-modal.mc-ui .profile-modal-toolbar .modal-close,
html body .profile-modal.mc-ui .profile-menu--toolbar .profile-menu-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  box-shadow: none;
  color: var(--c-aaaaaa, #aaa);
  font-size: 15px;
}
html body .profile-modal.mc-ui .profile-modal-toolbar .modal-close:hover,
html body .profile-modal.mc-ui .profile-menu--toolbar .profile-menu-btn:hover {
  background: var(--mc-btn-hover, #333);
  color: var(--mc-text, #fff);
}
html body .profile-modal.mc-ui { padding-top: 44px; }
@media (max-width: 760px) { html body .profile-modal.mc-ui { padding-top: 44px; } }
