/* Экраны «Кошелёк» (нижний лист), «Рейтинг» и «Профиль». Только общие переменные оболочки (:root):
   --bg --surface --surface-2 --ink --ink-soft --line --accent --accent-ink --good --bad --radius-card
   --radius-chip --shadow-card --safe-* --nav-h. Свои производные цвета — через color-mix от них, поэтому светлая
   и тёмная темы получаются автоматически. */

.ws-root,
.lb,
.pf {
  --scr-gold: #f2b928;
  --scr-gold-ink: #5a3d00;
  --scr-silver: #a9b3c2;
  --scr-bronze: #d68a4e;
  --scr-soft: var(--surface-2);
  --scr-good-soft: rgba(31, 157, 85, 0.12);
  --scr-good-soft: color-mix(in srgb, var(--good) 14%, transparent);
  --scr-bad-soft: rgba(224, 72, 62, 0.12);
  --scr-bad-soft: color-mix(in srgb, var(--bad) 14%, transparent);
  --scr-r-row: 22px;
  --scr-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.ws-root [hidden],
.lb [hidden],
.pf [hidden] {
  display: none !important;
}

.tone-good {
  color: var(--good);
}

.tone-bad {
  color: var(--bad);
}

.ws-root button,
.lb button,
.pf button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.ws-root button:focus-visible,
.lb button:focus-visible,
.pf button:focus-visible,
.ws-input:focus-visible,
.pf-ref-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- скелетоны --------------------------------------------------------------------------- */

.skel {
  display: block;
  border-radius: 999px;
  background: var(--surface-2);
  background-image: linear-gradient(90deg, transparent 0, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
  background-image: linear-gradient(90deg, transparent 0, color-mix(in srgb, var(--surface) 60%, transparent) 50%, transparent 100%);
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: scr-shimmer 1.3s ease-in-out infinite;
}

.skel-line {
  height: 12px;
  width: 70%;
}

.skel-line.short {
  width: 42%;
}

.skel-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}

.skel-circle.big {
  width: 56px;
  height: 56px;
}

.skel-circle.huge {
  width: 112px;
  height: 112px;
}

.skel-rank {
  width: 22px;
  height: 14px;
  flex: none;
}

.skel-amount {
  width: 64px;
  height: 14px;
  flex: none;
}

@keyframes scr-shimmer {
  from {
    background-position: 150% 0;
  }
  to {
    background-position: -50% 0;
  }
}

@keyframes scr-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes scr-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- общие состояния (пусто / ошибка) ------------------------------------------------------ */

.ws-state,
.lb-state,
.pf-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 20px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.ws-state-icon,
.lb-state-icon,
.pf-state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
}

.ws-state-error .ws-state-icon,
.lb-state-error .lb-state-icon,
.pf-state .pf-state-icon {
  background: var(--scr-bad-soft);
  color: var(--bad);
}

.ws-state-title,
.lb-state-title,
.pf-state-title {
  font-weight: 700;
  font-size: 16px;
}

.ws-state-text,
.lb-state-text,
.pf-state-text {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 300px;
  line-height: 1.4;
}

.ws-retry,
.lb-retry,
.pf-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--accent-ink) !important;
  font-weight: 700;
}

/* ============================================================================================
   Кошелёк — нижний лист
   ============================================================================================ */

.ws-root {
  position: fixed;
  inset: 0;
  z-index: 80;
}

html.ws-sheet-open,
html.ws-sheet-open body {
  overflow: hidden;
}

.ws-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.5);
  opacity: 0;
  transition: opacity 0.28s ease;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.ws-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 540px);
  height: calc(100% - var(--safe-t) - 10px);
  background: var(--bg);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, 104%);
  transition: transform 0.3s var(--scr-ease);
  outline: none;
  overflow: hidden;
}

.ws-root.is-open .ws-backdrop {
  opacity: 1;
}

.ws-root.is-open .ws-sheet {
  transform: translate(-50%, 0);
}

@media (min-width: 700px) and (min-height: 640px) {
  .ws-sheet {
    bottom: 24px;
    height: min(880px, calc(100% - 48px));
    border-radius: var(--radius-card);
    transform: translate(-50%, calc(100% + 40px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-sheet,
  .ws-backdrop {
    transition: none;
  }
  .skel {
    animation: none;
  }
}

.ws-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 12px 20px;
  flex: none;
}

.ws-grabber {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 999px;
  background: var(--line);
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}

.ws-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ws-mode {
  padding: 5px 10px;
  border-radius: var(--radius-chip);
  background: rgba(242, 185, 40, 0.18);
  background: color-mix(in srgb, var(--scr-gold) 22%, transparent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ws-icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  flex: none;
}

.ws-icon-btn:active {
  transform: scale(0.94);
}

.ws-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(28px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Баланс: инвертированная карточка (тёмная в светлой теме, светлая в тёмной). */
.ws-hero {
  position: relative;
  overflow: hidden;
  padding: 20px 22px 22px;
  border-radius: var(--radius-card);
  background: var(--ink);
  color: var(--bg);
  flex: none;
}

.ws-hero-glow {
  position: absolute;
  right: -60px;
  top: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 185, 40, 0.42), transparent 68%);
  pointer-events: none;
}

.ws-hero-glow::after {
  content: '';
  position: absolute;
  left: -120px;
  top: 170px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 200, 120, 0.3), transparent 70%);
}

.ws-hero-label {
  position: relative;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.68;
  letter-spacing: 0.02em;
}

.ws-hero-amount {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  min-width: 0;
}

.ws-coin {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
}

.ws-balance-value {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-hero-unit {
  align-self: flex-end;
  padding-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
  opacity: 0.6;
}

.ws-card {
  padding: 14px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  flex: none;
}

.ws-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
}

.ws-seg-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-chip);
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft) !important;
  transition: background 0.18s ease, color 0.18s ease;
}

.ws-seg-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.ws-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ws-seg + .ws-form {
  margin-top: 14px;
}

.ws-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-field-label {
  padding-left: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.ws-input-wrap {
  display: flex;
  align-items: center;
  height: 62px;
  padding: 0 18px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}

.ws-input-wrap:focus-within {
  border-color: var(--accent);
}

.ws-input[aria-invalid='true'] {
  color: var(--bad);
}

.ws-input-wrap:has(.ws-input[aria-invalid='true']) {
  border-color: var(--bad);
}

.ws-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.ws-input::placeholder {
  color: var(--ink-soft);
  opacity: 0.5;
}

.ws-input-unit {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

.ws-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ws-chip {
  flex: 1 1 0;
  min-width: 52px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.ws-chip:active {
  transform: scale(0.95);
}

.ws-chip.is-active {
  background: var(--accent);
  color: var(--accent-ink) !important;
}

.ws-chip:disabled {
  opacity: 0.5;
}

.ws-error {
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--scr-bad-soft);
  color: var(--bad);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  animation: scr-rise 0.2s ease;
}

.ws-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--accent-ink) !important;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.ws-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.ws-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.ws-submit.is-busy {
  opacity: 0.85;
}

.ws-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  animation: scr-spin 0.7s linear infinite;
}

.ws-submit.is-busy .ws-spinner {
  display: inline-block;
}

.ws-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.ws-note .icon {
  flex: none;
}

.ws-soon {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: var(--surface-2);
}

.ws-soon-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  flex: none;
}

.ws-soon-title {
  font-weight: 800;
  font-size: 16px;
}

.ws-soon-text {
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

/* История */
.ws-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}

.ws-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 4px 0;
}

.ws-h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ws-filters {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 2px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ws-filters::-webkit-scrollbar {
  display: none;
}

.ws-filter {
  flex: none;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft) !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.ws-filter.is-active {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink) !important;
}

.ws-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 0.2s ease;
}

.ws-list.is-refreshing {
  opacity: 0.6;
}

.ws-day {
  padding: 10px 6px 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.ws-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-radius: var(--scr-r-row);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.ws-row-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  flex: none;
}

.ws-row-icon.tone-good {
  background: var(--scr-good-soft);
}

.ws-row-icon.tone-bad {
  background: var(--scr-bad-soft);
}

.ws-row.kind-cashout .ws-row-icon {
  background: rgba(242, 185, 40, 0.2);
  background: color-mix(in srgb, var(--scr-gold) 24%, transparent);
  color: #b07b00;
  color: color-mix(in srgb, var(--scr-gold) 70%, var(--ink));
}

.ws-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.ws-row-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.ws-row-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.ws-row-fee {
  padding: 1px 7px;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ws-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
  max-width: 46%;
  text-align: right;
}

.ws-row-amount {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ws-row-after {
  font-size: 11.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ws-row-skel {
  box-shadow: none;
}

.ws-row-skel .ws-row-main {
  gap: 8px;
}

.ws-more {
  align-self: center;
  height: 44px;
  margin-top: 4px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: var(--surface);
  font-weight: 700;
}

.ws-sentinel {
  height: 1px;
}

.ws-end,
.ws-inline-error {
  padding: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.ws-inline-error {
  color: var(--bad);
}

/* ============================================================================================
   Рейтинг
   ============================================================================================ */

.lb,
.pf {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--nav-h, 96px) + 20px);
  box-sizing: border-box;
}

.lb-pull {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lb.is-pulling .lb-pull {
  height: var(--lb-pull, 0);
  opacity: 1;
}

.lb.is-pulling > :not(.lb-pull) {
  transform: translateY(var(--lb-pull, 0));
}

.lb-pull .icon {
  transition: transform 0.2s ease;
}

.lb.is-pull-ready .lb-pull .icon {
  transform: rotate(180deg);
}

.lb-head,
.pf-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 0;
}

.lb-head-text {
  flex: 1;
  min-width: 0;
}

.lb-title,
.pf-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.lb-sub {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

.lb-refresh {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  flex: none;
}

.lb.is-loading .lb-refresh .icon {
  animation: scr-spin 0.8s linear infinite;
}

/* Своя сводка */
.lb-me-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px 12px 12px;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-card);
}

.lb-me-card.is-hidden {
  display: none;
}

.lb-me-card.is-empty {
  background: var(--surface);
  color: var(--ink);
}

.lb-me-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  flex: none;
}

.lb-me-text {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
}

.lb-me-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.lb-me-label {
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.7;
}

.lb-me-rank {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.lb-me-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.lb-me-profit {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* На инвертированной карточке тон берём светлее, чтобы читался на тёмном и на светлом фоне. */
.lb-me-card .lb-me-profit.tone-good {
  color: color-mix(in srgb, var(--good) 75%, var(--accent-ink));
}

.lb-me-card .lb-me-profit.tone-bad {
  color: color-mix(in srgb, var(--bad) 75%, var(--accent-ink));
}

.lb-me-games {
  font-size: 12.5px;
  opacity: 0.7;
}

.lb-me-card .skel {
  background-color: color-mix(in srgb, var(--accent-ink) 18%, transparent);
}

.lb-unit {
  font-size: 0.72em;
  font-weight: 700;
  opacity: 0.7;
}

/* Пьедестал */
.lb-podium {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  align-items: end;
  gap: 8px;
  padding-top: 18px;
}

.lb-podium:empty {
  display: none;
}

.lb-podium[data-count='1'] {
  grid-template-columns: minmax(0, 220px);
  justify-content: center;
}

.lb-podium[data-count='2'] {
  grid-template-columns: 1fr 1.12fr;
}

.lb-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 8px 14px;
  border-radius: var(--radius-card);
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: scr-rise 0.3s ease both;
}

.lb-step-1 {
  min-height: 200px;
  background: linear-gradient(180deg, rgba(242, 185, 40, 0.34), rgba(242, 185, 40, 0.1)), var(--surface);
  background: linear-gradient(180deg, color-mix(in srgb, var(--scr-gold) 42%, var(--surface)), color-mix(in srgb, var(--scr-gold) 12%, var(--surface)));
  animation-delay: 0.04s;
}

.lb-step-2 {
  min-height: 168px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--scr-silver) 40%, var(--surface)), color-mix(in srgb, var(--scr-silver) 12%, var(--surface)));
}

.lb-step-3 {
  min-height: 152px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--scr-bronze) 36%, var(--surface)), color-mix(in srgb, var(--scr-bronze) 10%, var(--surface)));
  animation-delay: 0.08s;
}

.lb-step.is-skel {
  background: var(--surface);
  justify-content: flex-end;
  gap: 12px;
  padding-bottom: 22px;
}

.lb-step.is-me {
  outline: 2.5px solid var(--accent);
  outline-offset: -2.5px;
}

.lb-crown {
  position: absolute;
  top: -16px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: var(--scr-gold);
  color: var(--scr-gold-ink);
  box-shadow: 0 4px 12px rgba(242, 185, 40, 0.45);
}

.lb-step-avatar {
  position: relative;
  margin-top: -22px;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.lb-step-1 .lb-step-avatar {
  margin-top: 26px;
  box-shadow: 0 0 0 3px var(--scr-gold), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.lb-step-2 .lb-step-avatar {
  box-shadow: 0 0 0 3px var(--scr-silver), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.lb-step-3 .lb-step-avatar {
  box-shadow: 0 0 0 3px var(--scr-bronze), 0 6px 16px rgba(0, 0, 0, 0.12);
}

.lb-step-2,
.lb-step-3 {
  padding-top: 0;
}

.lb-step-2 .lb-step-avatar,
.lb-step-3 .lb-step-avatar {
  margin-top: 18px;
}

.lb-step-badge {
  position: absolute;
  left: 50%;
  bottom: -10px;
  min-width: 30px;
  height: 22px;
  margin-left: -15px;
  padding: 0 6px;
  border-radius: var(--radius-chip);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.lb-step-name {
  max-width: 100%;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-step-profit,
.lb-me-profit {
  display: inline-flex;
  align-items: center;
}

.lb-step-profit {
  max-width: 100%;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-step-games {
  font-size: 12px;
  color: var(--ink-soft);
}

/* Список */
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lb-list:empty {
  display: none;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 14px 10px 12px;
  border-radius: var(--scr-r-row);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: scr-rise 0.25s ease both;
}

.lb-rank {
  width: 26px;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  text-align: center;
  flex: none;
}

.lb-row .avatar {
  flex: none;
}

.lb-who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.lb-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-you {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  background: var(--accent-ink);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex: none;
}

.lb-coin {
  display: inline-grid;
  place-items: center;
  margin-right: 4px;
  color: var(--scr-gold);
  vertical-align: -2px;
}

.lb-coin .icon {
  display: block;
}

.lb-profit {
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-trend {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
}

.lb-trend-up {
  background: var(--scr-good-soft);
  color: var(--good);
}

.lb-trend-down {
  background: var(--scr-bad-soft);
  color: var(--bad);
}

.lb-new {
  display: inline-grid;
  place-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-chip);
  background: var(--scr-gold);
  color: var(--scr-gold-ink);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.lb-row.is-me {
  background: var(--accent);
  color: var(--accent-ink);
}

.lb-row.is-me .lb-rank,
.lb-row.is-me .lb-meta {
  color: inherit;
  opacity: 0.72;
}

.lb-row.is-me .lb-profit.tone-good {
  color: color-mix(in srgb, var(--good) 75%, var(--accent-ink));
}

.lb-row.is-me .lb-profit.tone-bad {
  color: color-mix(in srgb, var(--bad) 75%, var(--accent-ink));
}

.lb-row.is-me .lb-trend {
  background: color-mix(in srgb, var(--accent-ink) 16%, transparent);
  color: var(--accent-ink);
}

.lb-row.is-skel {
  box-shadow: none;
  gap: 14px;
}

.lb-row.is-skel .lb-who {
  gap: 8px;
}

.lb-pinned {
  position: sticky;
  bottom: calc(var(--nav-h, 96px) + 8px);
  z-index: 3;
  margin-top: -2px;
}

.lb-pinned .lb-row {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.lb-foot {
  display: flex;
  justify-content: center;
  min-height: 18px;
}

.lb-updated {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ============================================================================================
   Профиль
   ============================================================================================ */

.pf-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 20px 22px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.pf-hero.is-skel {
  gap: 12px;
}

.pf-hero-bg {
  position: absolute;
  inset: 0 0 auto;
  height: 96px;
  background: radial-gradient(120px 90px at 18% 10%, color-mix(in srgb, var(--good) 26%, transparent), transparent 70%),
    radial-gradient(140px 100px at 86% 0%, color-mix(in srgb, var(--scr-gold) 32%, transparent), transparent 70%),
    var(--surface-2);
  pointer-events: none;
}

.pf-avatar {
  position: relative;
  margin-top: 6px;
  margin-bottom: 8px;
  padding: 4px;
  border-radius: 50%;
  background: var(--surface);
}

.pf-avatar .avatar-ring-track {
  stroke: var(--surface-2);
}

.pf-avatar .avatar-ring-bar {
  stroke: var(--good);
}

/* Нулевая доля: скруглённый конец дуги нулевой длины рисуется точкой — прячем дугу. */
.pf-avatar.is-zero .avatar-ring-bar {
  display: none;
}

.pf-avatar.is-zero .pf-ring-label {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.pf-ring-label {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  padding: 3px 9px;
  border-radius: var(--radius-chip);
  background: var(--good);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 0 0 3px var(--surface);
}

.pf-name {
  position: relative;
  margin: 6px 0 0;
  max-width: 100%;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-handle {
  font-size: 14px;
  color: var(--ink-soft);
}

.pf-rank {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-chip);
  background: color-mix(in srgb, var(--scr-gold) 22%, var(--surface));
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pf-rank .icon {
  color: color-mix(in srgb, var(--scr-gold) 70%, var(--ink));
}

.pf-rank.is-none {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.pf-rank.is-none .icon {
  color: inherit;
}

.pf-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 14px 12px 12px;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--accent);
  color: var(--accent-ink) !important;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 0.1s ease;
}

.pf-wallet:active {
  transform: scale(0.985);
}

.pf-wallet-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-ink) 14%, transparent);
  flex: none;
}

.pf-wallet-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.pf-wallet-title {
  font-size: 17px;
  font-weight: 800;
}

.pf-wallet-sub {
  font-size: 12.5px;
  line-height: 1.3;
  opacity: 0.7;
}

.pf-wallet-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 8px;
  border-radius: var(--radius-chip);
  background: var(--accent-ink);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: none;
}

.pf-wallet-balance .icon {
  color: var(--scr-gold);
}

.pf-wallet-go {
  display: grid;
  place-items: center;
  opacity: 0.7;
  flex: none;
}

.pf-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 560px) {
  .pf-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.pf-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px 14px 16px;
  border-radius: var(--scr-r-row);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.pf-stat.is-skel {
  gap: 10px;
  min-height: 96px;
  justify-content: flex-end;
}

.pf-stat-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
}

.pf-stat[data-stat='profit'] .pf-stat-icon {
  background: var(--scr-good-soft);
  color: var(--good);
}

.pf-stat[data-stat='win_rate'] .pf-stat-icon,
.pf-stat[data-stat='best'] .pf-stat-icon {
  background: color-mix(in srgb, var(--scr-gold) 22%, transparent);
  color: color-mix(in srgb, var(--scr-gold) 70%, var(--ink));
}

.pf-stat[data-stat='kills'] .pf-stat-icon {
  background: var(--scr-bad-soft);
  color: var(--bad);
}

.pf-stat-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.pf-ref {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.pf-ref-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pf-ref-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: var(--scr-good-soft);
  color: var(--good);
  flex: none;
}

.pf-ref-titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.pf-ref-title {
  font-size: 17px;
  font-weight: 800;
}

.pf-ref-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.pf-ref-count {
  flex: none;
  padding: 6px 10px;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pf-ref-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pf-ref-label {
  padding-left: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.pf-ref-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  box-sizing: border-box;
  outline: none;
}

.pf-ref-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pf-ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 800;
  transition: transform 0.1s ease;
}

.pf-ref-btn.is-primary {
  background: var(--accent);
  color: var(--accent-ink) !important;
}

.pf-ref-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.pf-ref-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
