/* =========================================================
   Модуль «Карточка-звезда» (js/mods/playercards.js)
   Префиксы: .pcs / .pcs__* — карточка игрока,
             .pcs-seg* — переключатель составов,
             .pcs-pod* / .pcs-podium — подиум на главной.
   Базовые классы (.player*, .podium*, .scope-chip) переопределяются
   только внутри своих обёрток (.pcs, .pcs-podium, .pcs-seg).
   ========================================================= */

/* ---------- 1. Карточка игрока ---------- */
.players-grid.pcs-grid { align-items: stretch; }

.player.pcs {
  /* дуотон амплуа: нападающий — фирменный оранжевый */
  --pcs-a: #F2894A;
  --pcs-b: #E06030;
  --pcs-card: #15110f;
  --pcs-frame: linear-gradient(165deg, var(--pcs-a) 0%, var(--pcs-b) 46%, rgba(255,255,255,.10) 78%, var(--pcs-a) 100%);
  display: flex; flex-direction: column;
  border: 1.5px solid transparent;
  background: linear-gradient(var(--pcs-card), var(--pcs-card)) padding-box, var(--pcs-frame) border-box;
}
.player.pcs[data-pos="Вратарь"]  { --pcs-a: #FFE3C4; --pcs-b: #FFB877; }
.player.pcs[data-pos="Защитник"] { --pcs-a: #D9531F; --pcs-b: #8E2F12; }
/* базовый hover и «бомбардир №1» красят рамку сплошным цветом — оставляем градиент */
.player.pcs:hover, .player.pcs.player--top { border-color: transparent; }

/* флип-карточка: лицевая сторона тянется на всю высоту, как и обычная */
.player.pcs > .player__flip { flex: 1 1 auto; display: flex; flex-direction: column; }
.player.pcs .player__face--front { flex: 1 1 auto; display: flex; flex-direction: column; }

/* полоса амплуа сверху */
.player.pcs .player__accent { height: 5px; background: linear-gradient(90deg, var(--pcs-a), var(--pcs-b)); }
.player.pcs[data-pos="Вратарь"] .player__accent { background: linear-gradient(90deg, var(--pcs-a), var(--pcs-b)); }

/* --- Уровни (тиры) --- */
.player.pcs--rookie { --pcs-frame: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.14)); }
.player.pcs--ingame {
  --pcs-frame: linear-gradient(165deg, var(--pcs-a) 0%, rgba(255,255,255,.12) 34%, rgba(255,255,255,.08) 72%, var(--pcs-b) 100%);
}
.player.pcs--star {
  --pcs-frame: linear-gradient(165deg, #ffe39a 0%, #e0a020 30%, var(--pcs-b) 62%, #ffd76e 100%);
  border-width: 2px;
  box-shadow: 0 0 0 1px rgba(255,215,110,.22), 0 16px 40px rgba(224,96,48,.26);
}
.player.pcs--star:hover, .player.pcs--star.player--top {
  box-shadow: 0 0 0 1px rgba(255,215,110,.4), 0 20px 50px rgba(224,96,48,.36);
}

/* --- Верх: портрет или инициалы --- */
.player.pcs .pcs__hero {
  position: relative; display: block; height: 204px; flex: none;
  overflow: hidden; isolation: isolate;
  background: #1c1512;
}
/* дуотон-градиент амплуа */
.player.pcs .pcs__hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: .42;
  background:
    radial-gradient(80% 70% at 88% 4%, rgba(255,255,255,.55), transparent 62%),
    linear-gradient(155deg, var(--pcs-a) 0%, var(--pcs-b) 55%, rgba(0,0,0,0) 100%);
}
/* затемнение сверху (под номер) и растворение в тело карточки снизу */
.player.pcs .pcs__hero::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  --pcs-scrim: linear-gradient(180deg, rgba(10,8,7,.50) 0%, rgba(10,8,7,0) 36%, rgba(21,17,15,0) 54%, rgba(21,17,15,.86) 88%, var(--pcs-card) 100%);
  --pcs-foil: linear-gradient(transparent, transparent);
  --pcs-vig: linear-gradient(transparent, transparent);
  /* растворение — верхним слоем: фольга и виньетка тоже уходят в тело карточки без шва */
  background: var(--pcs-scrim), var(--pcs-foil), var(--pcs-vig);
}
/* портрет: студийная виньетка по бокам (прячет огрехи вырезки фона) и плотнее тень под номером */
.player.pcs .pcs__hero--photo::after {
  --pcs-scrim: linear-gradient(180deg, rgba(10,8,7,.62) 0%, rgba(10,8,7,0) 36%, rgba(21,17,15,0) 72%, rgba(21,17,15,.7) 93%, var(--pcs-card) 100%);
  --pcs-vig: linear-gradient(90deg, rgba(8,6,5,.94) 0%, rgba(8,6,5,0) 24%, rgba(8,6,5,0) 64%, rgba(8,6,5,.94) 90%);
}
/* «звезда»: голографическая полоса-фольга */
.player.pcs--star .pcs__hero::after {
  --pcs-foil: linear-gradient(115deg, transparent 32%, rgba(255,215,110,.16) 46%, rgba(116,221,155,.08) 53%, transparent 66%);
}
.pcs__ini {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  padding-top: 14px;
  font-family: "Unbounded", sans-serif; font-weight: 800; font-size: 68px; line-height: 1; letter-spacing: -.04em;
  color: #fff; text-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.pcs__puck {
  position: absolute; right: -22px; bottom: 6px; z-index: 0; width: 132px; height: 132px;
  color: #fff; opacity: .12; transform: rotate(-14deg);
}
.pcs__puck svg { width: 100%; height: 100%; display: block; stroke-width: 1.2; }
.pcs__photo {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 30%;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}

/* номер — крупно, как на свитере */
.player.pcs .player__num,
.player.pcs:hover .player__num {
  position: absolute; top: 15px; left: 14px; right: auto; z-index: 3;
  font-family: "Unbounded", sans-serif; font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.05em;
  color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.6);
}

/* уровень */
.pcs__tier {
  position: absolute; top: 16px; right: 12px; z-index: 3;
  font-size: 10px; font-weight: 700; line-height: 1; text-transform: uppercase; letter-spacing: .08em;
  padding: 6px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(10,8,7,.72); color: var(--text); border: 1px solid rgba(255,255,255,.22);
}
.pcs__tier--star { background: linear-gradient(140deg, #ffe08a, #e0a020); color: #1a0e05; border-color: transparent; }
.pcs__tier--fighter { background: var(--ice); color: #1a0e05; border-color: transparent; }
.pcs__tier--rookie { color: var(--muted); }

/* «К»/«А» и «Бомбардир №1» — в нижних углах портрета */
.player.pcs .pcs__hero .player__badge { top: auto; left: auto; right: 12px; bottom: 12px; z-index: 3; }
.player.pcs .pcs__hero .player__topbadge { top: auto; left: 12px; bottom: 12px; z-index: 3; }

/* --- Тело --- */
.player.pcs .player__body {
  flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start;
  padding: 6px 16px 16px;
}
.player.pcs .player__name { margin: 0 0 8px; }
.player.pcs .player__pos { margin-bottom: 0; }
.player.pcs[data-pos="Вратарь"] .player__pos { color: #FFE3C4; }
.player.pcs .player__teams { justify-content: flex-start; margin: 10px 0 0; }

/* --- Бейджи достижений --- */
.pcs__badges { display: flex; align-items: center; gap: 7px; margin-top: 14px; }
.pcs__badge {
  position: relative; flex: none; width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.pcs__badge svg { width: 18px; height: 18px; display: block; }
.pcs__badge--gold { background: linear-gradient(140deg, #ffe08a, #e0a020); color: #1a0e05; box-shadow: 0 4px 14px rgba(224,160,32,.28); }
.pcs__badge--ice  { background: rgba(255,184,119,.14); color: var(--ice); box-shadow: inset 0 0 0 1px rgba(255,184,119,.42); }
.pcs__badge--win  { background: rgba(116,221,155,.12); color: var(--ice-2); box-shadow: inset 0 0 0 1px rgba(116,221,155,.4); }
.pcs__badge b {
  position: absolute; top: -6px; right: -7px; min-width: 19px; height: 17px; padding: 0 4px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  background: #0a0a0c; color: #ffd76e; box-shadow: 0 0 0 1px #e0a020;
}
.pcs__more {
  flex: none; height: 32px; min-width: 32px; padding: 0 8px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border);
}
.pcs__badgetxt { margin-top: 8px; font-size: 12px; line-height: 1.35; color: var(--muted); }

/* --- Статистика и подпись «за что цифры» — прижаты к низу карточки --- */
.pcs__foot { width: 100%; margin-top: auto; padding-top: 14px; }
.player.pcs .pcs__stats { gap: 6px; }
.player.pcs .player__stat { background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); padding: 8px 2px 7px; min-width: 0; }
.player.pcs .player__stat b { font-size: 18px; line-height: 1.15; }
.player.pcs .player__stat span { display: block; font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
.player.pcs .player__stat--pts { background: rgba(224,96,48,.14); box-shadow: inset 0 0 0 1px rgba(224,96,48,.32); }
.player.pcs .player__stat--pts b { color: var(--jupiter); }
.pcs__scope { margin-top: 8px; font-size: 11.5px; line-height: 1.3; color: var(--muted); }
/* «До «Звезды» — 3 очка»: мелкая тёплая строка под цифрами */
.pcs__next {
  display: flex; align-items: flex-start; gap: 5px; margin-top: 8px;
  font-size: 11.5px; font-weight: 600; line-height: 1.3; color: var(--ice);
}
.pcs__next svg { flex: none; width: 12px; height: 12px; margin-top: 1px; }

/* --- Блик и 3D-наклон: только мышь --- */
.pcs__glare { display: none; }
@media (hover: hover) and (pointer: fine) {
  .pcs__glare {
    display: block; position: absolute; inset: 0; z-index: 5; pointer-events: none; border-radius: inherit;
    background:
      radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.20), rgba(255,255,255,0) 52%);
    opacity: 0; transition: opacity .25s;
  }
  .pcs--star .pcs__glare {
    background:
      radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,226,150,.26), rgba(255,184,119,.08) 38%, rgba(255,255,255,0) 60%);
  }
  .player.pcs.is-tilting { transition: transform .09s linear, box-shadow .25s; will-change: transform; z-index: 2; }
  .player.pcs.is-tilting .pcs__glare { opacity: 1; }
  .player.pcs.is-settling { transition: transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
  .player.pcs:hover .pcs__photo { transform: scale(1.05); }
}

/* --- Телефон: две колонки --- */
@media (max-width: 560px) {
  .player.pcs .pcs__hero { height: 150px; }
  .pcs__ini { font-size: 50px; padding-top: 12px; }
  .pcs__puck { width: 96px; height: 96px; right: -16px; bottom: 8px; }
  .player.pcs .player__num, .player.pcs:hover .player__num { font-size: 34px; top: 13px; left: 11px; }
  .pcs__tier { top: 13px; right: 9px; font-size: 9.5px; padding: 5px 7px; letter-spacing: .05em; }
  .player.pcs .pcs__hero .player__badge { right: 9px; bottom: 9px; }
  .player.pcs .pcs__hero .player__topbadge { left: 9px; bottom: 9px; font-size: 9px; padding: 4px 7px; letter-spacing: .2px; }
  .player.pcs .player__body { padding: 4px 11px 12px; }
  .player.pcs .player__name { margin-bottom: 6px; }
  .player.pcs .player__teams { gap: 4px; margin-top: 8px; }
  .player.pcs .pteam { font-size: 10px; padding: 3px 6px; }
  .pcs__badges { gap: 6px; margin-top: 11px; }
  .pcs__badge, .pcs__more { width: 30px; height: 30px; border-radius: 9px; }
  .pcs__more { width: auto; min-width: 30px; padding: 0 6px; }
  .pcs__badgetxt { font-size: 11.5px; margin-top: 7px; }
  .pcs__foot { padding-top: 11px; }
  .player.pcs .pcs__stats { gap: 4px; }
  .player.pcs .player__stat { padding: 7px 1px 6px; border-radius: 9px; }
  .player.pcs .player__stat b { font-size: 15px; }
  .player.pcs .player__stat span { font-size: 9.5px; letter-spacing: 0; }
  .pcs__scope { font-size: 11px; margin-top: 7px; }
  .pcs__next { font-size: 11px; margin-top: 7px; gap: 4px; }
}

/* ---------- 2. Переключатель составов: «полка свитеров» ---------- */
.scope-switch.pcs-seg { align-items: stretch; gap: 10px; }
.pcs-seg .pcs-seg__btn {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px;
  min-height: 60px; padding: 10px 16px 10px 12px; border-radius: 16px;
  text-align: left; line-height: 1.2; color: var(--text);
  --pcs-sw: var(--muted);
}
.pcs-seg .pcs-seg__btn[data-kind="all"]     { --pcs-sw: var(--text); }
.pcs-seg .pcs-seg__btn[data-kind="ours"]    { --pcs-sw: var(--jupiter); }
.pcs-seg .pcs-seg__btn[data-kind="elder"]   { --pcs-sw: #E0662F; }
.pcs-seg .pcs-seg__btn[data-kind="younger"] { --pcs-sw: var(--ice); }
.pcs-seg .pcs-seg__btn[data-kind="cup"]     { --pcs-sw: #ffd76e; }
.pcs-seg__row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.pcs-seg__sw { flex: none; width: 22px; height: 22px; color: var(--pcs-sw); }
.pcs-seg__sw svg { width: 100%; height: 100%; display: block; }
.pcs-seg__title { font-family: "Unbounded", sans-serif; font-weight: 600; font-size: 13px; letter-spacing: -.01em; white-space: nowrap; }
.pcs-seg__meta { display: flex; align-items: center; gap: 8px; padding-left: 30px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pcs-seg .pcs-seg__meta i { font-style: normal; font-size: 12px; opacity: 1; }
.pcs-seg__rec {
  font-style: normal; font-weight: 700; font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.09); color: var(--text);
}
.pcs-seg .pcs-seg__btn.is-active { color: #1a0e05; --pcs-sw: #1a0e05; box-shadow: 0 8px 22px rgba(224,96,48,.28); }
.pcs-seg .pcs-seg__btn.is-active .pcs-seg__meta { color: #1a0e05; }
.pcs-seg .pcs-seg__btn.is-active .pcs-seg__rec { background: rgba(26,14,5,.86); color: #ffe3c4; }

@media (max-width: 720px) {
  /* одна строка с прокруткой вбок вместо пяти рядов чипов */
  .scope-switch.pcs-seg {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-left: calc(-1 * clamp(16px, 4vw, 40px)); margin-right: calc(-1 * clamp(16px, 4vw, 40px));
    padding: 6px clamp(16px, 4vw, 40px) 18px; scroll-padding: 0 clamp(16px, 4vw, 40px);
    margin-bottom: 4px;
  }
  .pcs-seg .pcs-seg__btn.is-active { box-shadow: 0 6px 14px rgba(224,96,48,.26); }
  .scope-switch.pcs-seg::-webkit-scrollbar { display: none; }
  .pcs-seg .pcs-seg__btn { flex: none; scroll-snap-align: start; padding: 9px 12px 9px 10px; }
}
@media (max-width: 560px) {
  /* компактнее: на экране 390px из-за края должен выглядывать третий состав — иначе не видно, что полку можно листать */
  .scope-switch.pcs-seg { gap: 8px; }
  .pcs-seg__row { gap: 7px; }
  .pcs-seg__sw { width: 20px; height: 20px; }
  .pcs-seg__title { font-size: 12px; }
  .pcs-seg__meta { padding-left: 27px; gap: 6px; }
}
@media (max-width: 380px) {
  .pcs-seg .pcs-seg__btn { padding: 9px 10px 9px 9px; }
  .pcs-seg__title { font-size: 11.5px; }
  .pcs-seg__meta { font-size: 11.5px; }
  .pcs-seg .pcs-seg__meta i { font-size: 11.5px; }
}

/* ---------- 3. Подиум-«сцена» на главной ---------- */
.podium.pcs-podium { position: relative; isolation: isolate; align-items: end; gap: 10px; padding-top: 8px; }
/* «софит» за лидером */
.podium.pcs-podium::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: 12%; right: 12%; top: -18px; height: 76%;
  background: radial-gradient(50% 60% at 50% 38%, rgba(242,137,74,.26), rgba(242,137,74,0) 72%);
}
.pcs-podium .podium__item { display: flex; flex-direction: column; align-items: center; min-width: 0; position: relative; }
.pcs-podium .podium__ava { flex: none; overflow: visible; margin-bottom: 9px; box-shadow: 0 0 0 3px #c9ccd3, 0 10px 24px rgba(0,0,0,.4); }
.pcs-podium .podium__ava img { border-radius: 50%; }
.pcs-podium .podium__item--1 .podium__ava { width: 96px; height: 96px; box-shadow: 0 0 0 3px #e9b030, 0 0 0 7px rgba(255,215,110,.16), 0 12px 30px rgba(224,160,32,.34); }
.pcs-podium .podium__item--3 .podium__ava { box-shadow: 0 0 0 3px #b9794a, 0 10px 24px rgba(0,0,0,.4); }
.pcs-podium .podium__name { max-width: 100%; overflow-wrap: anywhere; }
.pcs-pod__crown { display: block; width: 30px; height: 30px; margin-bottom: 3px; color: #ffd76e; }
.pcs-pod__crown svg { width: 100%; height: 100%; display: block; stroke: #b97a10; stroke-width: 1.2; }

.pcs-pod__block {
  position: relative; width: 100%; height: 62px; margin-top: 10px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 14px 14px 4px 4px;
}
.pcs-pod__block::before {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; transform-origin: 50% 100%;
  background: linear-gradient(180deg, rgba(255,184,119,.24), rgba(255,184,119,.04));
  box-shadow: inset 0 2px 0 rgba(255,255,255,.34), inset 0 0 0 1px rgba(255,184,119,.16);
}
.podium__item--1 .pcs-pod__block { height: 86px; }
.podium__item--1 .pcs-pod__block::before {
  background: linear-gradient(180deg, rgba(255,215,110,.34), rgba(224,96,48,.07));
  box-shadow: inset 0 2px 0 rgba(255,244,210,.55), inset 0 0 0 1px rgba(255,215,110,.26);
}
.podium__item--3 .pcs-pod__block { height: 50px; }
.pcs-pod__block .podium__pts, .pcs-pod__block .podium__sub { position: relative; z-index: 1; }
.pcs-pod__block .podium__pts { font-size: 22px; line-height: 1; color: var(--text); }
.podium__item--1 .pcs-pod__block .podium__pts { font-size: 30px; color: #ffd76e; }
.pcs-pod__block .podium__sub { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .pcs-pod__block::before { animation: pcsPodRise .7s cubic-bezier(.2,.8,.2,1) both; }
  .podium__item--2 .pcs-pod__block::before { animation-delay: .05s; }
  .podium__item--1 .pcs-pod__block::before { animation-delay: .18s; }
  .podium__item--3 .pcs-pod__block::before { animation-delay: .31s; }
  .pcs-pod__block .podium__pts, .pcs-pod__block .podium__sub { animation: pcsPodFade .45s ease-out .5s both; }
  .pcs-pod__crown { animation: pcsCrown 3.2s ease-in-out 1s infinite; }
}
@keyframes pcsPodRise { from { transform: scaleY(.08); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pcsPodFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pcsCrown { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-4deg); } }

@media (max-width: 560px) {
  .podium.pcs-podium { gap: 8px; }
  .pcs-podium .podium__ava { width: 64px; height: 64px; }
  .pcs-podium .podium__item--1 .podium__ava { width: 82px; height: 82px; }
  /* имя в две строки у всех троих — чтобы ступени пьедестала читались ровно */
  .pcs-podium .podium__name { font-size: 13px; min-height: 2.5em; }
  .pcs-pod__block { height: 62px; border-radius: 12px 12px 4px 4px; }
  .podium__item--1 .pcs-pod__block { height: 84px; }
  .podium__item--3 .pcs-pod__block { height: 50px; }
  .pcs-pod__block .podium__pts { font-size: 19px; }
  .podium__item--1 .pcs-pod__block .podium__pts { font-size: 25px; }
  .pcs-pod__crown { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .pcs__photo, .pcs__glare, .player.pcs.is-tilting, .player.pcs.is-settling { transition: none; }
  .player.pcs:hover .pcs__photo { transform: none; }
}
