/* ============================================================
   Топ-100 (/top) — подиум, список мест, «ты на N месте».
   ============================================================ */
/* overflow: clip, а не hidden — hidden ломает «прилипание» строки «ты на N месте» (position: sticky) */
.tp { position: relative; isolation: isolate; overflow: clip; padding-bottom: 40px; }
.tp-glow { display: none; }

/* ---- hero ---- */
.tp-hero { width: min(860px, 100% - 32px); margin: 0 auto; padding: 64px 0 26px; text-align: center; }
.tp-live {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 14px 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: var(--txt-2); font-size: 13px; font-weight: 600;
}
.tp-live i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--txt-3); }
.tp-live[data-state="on"] i, .tp-live[data-state="poll"] i { background: var(--ok); }
.tp-live[data-state="on"] { color: var(--txt); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }

.tp-hero__title {
  margin: 22px 0 0; font: 800 clamp(34px, calc(5.4vw / var(--z, 1)), 64px)/1.04 var(--font-display); letter-spacing: -.045em;
}
.tp-grad { color: #F5B83D; white-space: nowrap; }
.tp-hero__sub { margin: 18px auto 0; max-width: 640px; color: var(--txt-2); font-size: 17px; line-height: 1.6; }

/* сегмент-переключатель с бегающей «таблеткой» */
.tp-tabs {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; margin-top: 30px; padding: 5px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04);
}
.tp-tabs__thumb {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px;
  background: rgba(255,255,255,.12);
  transition: transform .3s var(--spring, cubic-bezier(.22,1,.36,1));
}
.tp-tabs[data-kind="buyers"] .tp-tabs__thumb { transform: translateX(100%); }
.tp-tab {
  position: relative; z-index: 1; min-width: 150px; padding: 11px 22px; border: 0; background: none; cursor: pointer;
  color: var(--txt-2); font: 700 15px/1 var(--font-body, inherit); border-radius: 999px; transition: color .25s;
}
.tp-tab[aria-selected="true"] { color: var(--txt); }
.tp-tab:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---- доска ---- */
.tp-board { width: min(880px, 100% - 32px); margin: 0 auto; }

/* подиум: 2 · 1 · 3 */
.tp-podium {
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 14px;
  margin: 26px auto 0; max-width: 700px;
  --gold: #F5B83D; --gold-2: #FFD97A; --silver: #B8C4D6; --silver-2: #E6ECF5; --bronze: #D98A4E; --bronze-2: #F2B37F;
}
.tp-pd { display: flex; flex-direction: column; align-items: center; min-width: 0; color: inherit; text-decoration: none; }
.tp-pd--1 { --m: var(--gold); --m2: var(--gold-2); --h: 150px; }
.tp-pd--2 { --m: var(--silver); --m2: var(--silver-2); --h: 112px; }
.tp-pd--3 { --m: var(--bronze); --m2: var(--bronze-2); --h: 86px; }
.tp-pd__who {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%;
  padding: 0 4px 14px; text-align: center; min-width: 0;
}
.tp-pd__ava {
  position: relative; width: 76px; height: 76px; border-radius: 50%; padding: 3px; flex: none;
  background: var(--m);
}
.tp-pd--1 .tp-pd__ava { width: 96px; height: 96px; }
.tp-pd__ava > img, .tp-pd__ava > .tp-ava__ph {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  border: 3px solid var(--bg-0); background: #17142a; font: 800 26px/1 var(--font-display); color: #fff;
}
.tp-pd__crown {
  position: absolute; right: -4px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: #1a1206;
  background: var(--m); border: 3px solid var(--bg-0);
}
.tp-pd__crown svg { width: 16px; height: 16px; }
.tp-pd--1 .tp-pd__crown { width: 34px; height: 34px; }
.tp-pd__ava .presence__dot { position: absolute; left: 4px; bottom: 4px; width: 13px; height: 13px; border: 2px solid var(--bg-0); box-shadow: none; }

.tp-pd__name {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px;
  max-width: 100%; margin-top: 6px; font-weight: 800; font-size: 16px;
}
.tp-pd__name > .nick {
  min-width: 0; max-width: 100%; white-space: nowrap; text-overflow: ellipsis;
  overflow: hidden; overflow: clip; overflow-clip-margin: 8px;
}
.tp-pd__val { color: var(--txt-2); font-size: 13.5px; }
.tp-pd__val b { color: var(--txt); font: 800 15px/1 var(--font-display); }
.tp-pd__val--link { color: var(--txt-2); text-decoration: underline dotted; text-underline-offset: 3px; }
.tp-pd__val--link:hover { color: var(--txt); }
.tp-pd__sub { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; color: var(--txt-3); font-size: 12.5px; }
.tp-pd__step {
  position: relative; width: 100%; height: var(--h); border-radius: 18px 18px 6px 6px; overflow: hidden;
  display: grid; place-items: start center; padding-top: 14px;
  background: color-mix(in srgb, var(--m) 16%, var(--bg-1));
  border: 1px solid color-mix(in srgb, var(--m) 45%, transparent); border-bottom: 0;
}
.tp-pd__num { font: 800 34px/1 var(--font-display); color: var(--m2); }
.tp-pd--1 .tp-pd__num { font-size: 44px; }
.tp-pd.is-new .tp-pd__ava { animation: tp-pulse 1.2s ease-out 2; }
@keyframes tp-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--m) 70%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.tp-pd.is-empty .tp-pd__ava { background: none; border: 2px dashed var(--line-hi); box-shadow: none; }
.tp-pd.is-empty .tp-pd__ava > .tp-ava__ph { border: 0; background: rgba(255,255,255,.03); color: var(--txt-3); }
.tp-pd.is-empty .tp-pd__crown { opacity: .45; }
.tp-pd.is-empty .tp-pd__name { color: var(--txt-2); font-weight: 700; }
.tp-pd.is-empty .tp-pd__step { opacity: .55; }
.tp-pd.is-skel .tp-pd__ava { background: rgba(255,255,255,.06); box-shadow: none; animation: tp-skel 1.4s ease-in-out infinite; }
.tp-pd.is-skel .tp-pd__step { background: rgba(255,255,255,.04); border-color: var(--line); animation: tp-skel 1.4s ease-in-out infinite; }

@keyframes tp-skel { 50% { opacity: .5; } }

/* ---- список мест ---- */
.tp-list-wrap {
  position: relative; margin-top: 0; border-radius: 18px; border: 1px solid var(--line);
  background: var(--bg-1);
}
.tp-list-head {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; padding: 14px 20px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--txt-3); font-size: max(11.5px, calc(9px / var(--z, 1))); font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.tp-list-head span:last-child { text-align: right; }
.tp-list { list-style: none; margin: 0; padding: 6px; }
.tp-row { position: relative; border-radius: 14px; }
.tp-row + .tp-row { margin-top: 2px; }
.tp-row__link {
  display: grid; grid-template-columns: 44px 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px; color: inherit; text-decoration: none;
  transition: background .25s;
}
.tp-row__link:hover { background: rgba(255,255,255,.045); }
.tp-row__rank { font: 800 16px/1 var(--font-display); color: var(--txt-3); text-align: center; font-variant-numeric: tabular-nums; }
.tp-row__ava { position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none; }
.tp-row__ava > img, .tp-row__ava > .tp-ava__ph {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: #17142a; border: 1px solid var(--line-hi); font-weight: 800; color: #fff;
}
.tp-row__ava .presence__dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2px solid var(--bg-0); box-shadow: none; }
.tp-row__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tp-row__name { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; min-width: 0; font-weight: 700; font-size: 15px; }
.tp-row__name > .nick {
  min-width: 0; max-width: 100%; white-space: nowrap; text-overflow: ellipsis;
  overflow: hidden; overflow: clip; overflow-clip-margin: 8px;
}
.tp-row__name .rec-badge { flex: none; margin-left: 0; }
.tp-row__sub { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--txt-3); font-size: 12.5px; }
.tp-row__sub > * { white-space: nowrap; }
.tp-star { color: var(--warn); font-weight: 700; }
.tp-row__val { display: flex; flex-direction: column; align-items: flex-end; min-width: 64px; text-align: right; }
.tp-row__val b { font: 800 17px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.tp-row__val small { color: var(--txt-3); font-size: max(11.5px, calc(9px / var(--z, 1))); }

/* сдвиги в рейтинге */
.tp-delta { min-width: 42px; text-align: center; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 8px; }
.tp-delta--none { padding: 0; }
.tp-delta--up { color: #34D399; background: rgba(52,211,153,.12); animation: tp-pop .5s var(--spring, ease) both; }
.tp-delta--new { color: #FFD97A; background: rgba(245,184,61,.14); text-transform: uppercase; letter-spacing: .06em; animation: tp-pop .5s var(--spring, ease) both; }
@keyframes tp-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.tp-row.is-up > .tp-row__link, .tp-row.is-new > .tp-row__link {
  background: rgba(52,211,153,.08);
  box-shadow: inset 3px 0 0 #34D399;
}
.tp-row.is-new > .tp-row__link { background: rgba(245,184,61,.08); box-shadow: inset 3px 0 0 #F5B83D; }

/* это ты */
.tp-you {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: max(11px, calc(9px / var(--z, 1))); font-weight: 800; color: #fff; background: var(--grad);
}
.tp-row.is-me > .tp-row__link { background: rgba(108,92,255,.12); box-shadow: inset 0 0 0 1px rgba(139,123,255,.45); }


/* свободное место */
.tp-row--open > .tp-row__link { border: 1px dashed var(--line-hi); grid-template-columns: 44px 44px minmax(0, 1fr) auto; }
.tp-row--open .tp-ava__ph { background: rgba(255,255,255,.03); border-style: dashed; color: var(--txt-2); font-size: 20px; font-weight: 600; }
.tp-row--open .tp-row__name { color: var(--txt-2); }
.tp-row__cta { font-weight: 700; font-size: 13.5px; color: var(--txt); white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.tp-row--open .tp-row__link:hover .tp-row__cta { background: rgba(255,255,255,.1); }
.tp-empty { padding: 26px 16px; text-align: center; color: var(--txt-2); }

.tp-row.is-skel { height: 64px; margin: 2px 0; background: rgba(255,255,255,.035); animation: tp-skel 1.4s ease-in-out infinite; }

/* ---- «ты на N месте»: прилипает к низу экрана, как строка You в Leaderboard Card ---- */
.tp-me {
  position: sticky; bottom: 12px; z-index: 5; margin: 6px; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px; border-radius: 16px;
  background: #16151F;
  border: 1px solid rgba(139,123,255,.45); box-shadow: 0 12px 32px -14px rgba(0,0,0,.9);
}
.tp-me .tp-row__ava { width: 40px; height: 40px; }
.tp-me__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.tp-me__title { font-weight: 700; font-size: 15px; }
.tp-me__rank { font: 800 17px/1 var(--font-display); color: #8B7BFF; }
.tp-me__txt small { color: var(--txt-2); font-size: 12.5px; }
.tp-me--guest { border-color: var(--line-hi); }
.tp-me--podium { border-color: rgba(245,184,61,.55); }

/* ---- кнопки ---- */
.tp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: 999px;
  color: var(--txt); text-decoration: none; font-weight: 700; white-space: nowrap;
  border: 1px solid var(--line-hi); background: rgba(255,255,255,.05); transition: background .2s, filter .2s;
}
.tp-btn:hover { background: rgba(255,255,255,.1); }
.tp-btn--main { border-color: transparent; background: var(--grad); color: #fff; }
.tp-btn--main:hover { background: var(--grad); filter: brightness(1.1); }
.tp-btn--sm { padding: 9px 16px; font-size: 14px; }

/* ---- финал ---- */
.tp-final { width: min(880px, 100% - 32px); margin: 60px auto 0; }
.tp-final__box {
  position: relative; overflow: hidden; padding: 36px 28px; border-radius: 18px; text-align: center;
  border: 1px solid var(--line); background: var(--bg-1);
}
.tp-final__title { margin: 0; font: 800 clamp(26px, calc(3.4vw / var(--z, 1)), 38px)/1.1 var(--font-display); letter-spacing: -.035em; }
.tp-final__sub { margin: 12px auto 0; max-width: 520px; color: var(--txt-2); line-height: 1.6; }
.tp-final__cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* ---- всплывашки «X поднимается на #N» ---- */
.tp-toasts {
  position: fixed; left: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px;
  width: min(340px, calc(calc(100vw / var(--z, 1)) - 32px)); pointer-events: none;
}
.tp-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  color: inherit; text-decoration: none;
  background: #16151F;
  border: 1px solid rgba(52,211,153,.35); box-shadow: 0 12px 32px -14px rgba(0,0,0,.9);
  animation: tp-toast-in .3s ease-out both;
  transition: opacity .35s, transform .35s;
}
.tp-toast.is-out { opacity: 0; transform: translateX(-20px); }
.tp-toast--gold { border-color: rgba(245,184,61,.5); }
.tp-toast__ico {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: #34D399; background: rgba(52,211,153,.12); font-weight: 800;
}
.tp-toast--gold .tp-toast__ico { background: rgba(245,184,61,.14); }
.tp-toast__ico .emo { width: 22px; height: 22px; }
.tp-toast__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; }
.tp-toast__txt > span { overflow: hidden; text-overflow: ellipsis; }
.tp-toast__txt small { color: var(--txt-3); font-size: 12px; }
@keyframes tp-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- телефон ---- */
@media (max-width: 640px) {
  .tp-hero { padding-top: 40px; }
  .tp-hero__sub { font-size: 15.5px; }
  .tp-tab { min-width: 0; padding: 10px 18px; font-size: 14px; }
  .tp-tabs { width: 100%; max-width: 360px; }
  .tp-podium { gap: 8px; }
  .tp-pd__ava { width: 60px; height: 60px; }
  .tp-pd--1 .tp-pd__ava { width: 74px; height: 74px; }
  .tp-pd__crown { width: 24px; height: 24px; }
  .tp-pd--1 .tp-pd__crown { width: 28px; height: 28px; }
  .tp-pd__crown svg { width: 13px; height: 13px; }
  .tp-pd__name { font-size: 14px; }
  .tp-pd__name .rec-badge { display: none; }
  .tp-pd__sub { display: none; }
  .tp-pd--1 { --h: 118px; } .tp-pd--2 { --h: 88px; } .tp-pd--3 { --h: 68px; }
  .tp-pd__num { font-size: 26px; } .tp-pd--1 .tp-pd__num { font-size: 34px; }
  .tp-list-head { grid-template-columns: 40px 1fr auto; padding: 12px 14px 10px; }
  .tp-list { padding: 4px; }
  /* на телефоне значок сдвига «▲ 2» уезжает под ник, чтобы не съедать ширину */
  .tp-row__link { grid-template-columns: 26px 38px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 0; padding: 9px 10px; }
  .tp-row__rank { grid-column: 1; grid-row: 1 / span 2; font-size: 14px; }
  .tp-row__ava { grid-column: 2; grid-row: 1 / span 2; width: 38px; height: 38px; }
  .tp-row__body { grid-column: 3; grid-row: 1; }
  .tp-delta { grid-column: 3; grid-row: 2; justify-self: start; min-width: 0; margin-top: 5px; padding: 2px 7px; font-size: max(11px, calc(9px / var(--z, 1))); }
  .tp-delta--none { display: none; }
  .tp-row__val { grid-column: 4; grid-row: 1 / span 2; min-width: 0; }
  .tp-row--open > .tp-row__link { grid-template-columns: 26px 38px minmax(0, 1fr); }
  .tp-row__cta { display: none; }
  .tp-hide-sm { display: none; }
  .tp-me { bottom: 8px; margin: 4px; }
  .tp-final__box { padding: 34px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .tp-toast { animation: none; }
}
