/**
 * Dark Liquid Glass — shared design system for TMA pages.
 * Tokens + base components. Page-specific layout stays in per-page CSS.
 */

/* ===== App Splash Preloader (no-flicker + safety fallback) ===== */
#app-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080a10;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#app-preloader.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#app-preloader.preloader-hidden,
#app-preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-preloader__ring {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background:
    conic-gradient(
      from 0deg,
      rgba(92, 240, 255, 0.05),
      #5cf0ff 35%,
      #8b6cff 70%,
      rgba(139, 108, 255, 0.08) 100%
    );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation:
    app-preloader-spin 0.85s linear infinite,
    app-preloader-pulse 1.4s ease-in-out infinite;
  will-change: transform, opacity;
}

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

@keyframes app-preloader-pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app-preloader__ring {
    animation: none;
    opacity: 0.9;
  }
}

/* ===== Design tokens ===== */
:root {
  /* Background */
  --dl-bg-base: #080a10;
  --dl-bg-gradient-1: radial-gradient(ellipse 90% 55% at 50% -8%, rgba(56, 189, 255, 0.14) 0%, transparent 58%);
  --dl-bg-gradient-2: radial-gradient(ellipse 48% 38% at 100% 28%, rgba(139, 108, 255, 0.11) 0%, transparent 52%);
  --dl-bg-gradient-3: radial-gradient(ellipse 42% 34% at 0% 72%, rgba(67, 56, 202, 0.09) 0%, transparent 50%);

  /* Surfaces & strokes */
  --dl-surface: rgba(255, 255, 255, 0.03);
  --dl-surface-raised: rgba(255, 255, 255, 0.04);
  --dl-surface-sunken: rgba(0, 0, 0, 0.28);
  --dl-border: rgba(255, 255, 255, 0.08);
  --dl-border-strong: rgba(255, 255, 255, 0.10);

  /* Dark Liquid Glass */
  --dl-glass-bg: rgba(16, 18, 28, 0.46);
  --dl-glass-bg-strong: rgba(16, 18, 28, 0.52);
  --dl-glass-bg-modal: rgba(16, 18, 28, 0.58);
  --dl-glass-bg-fallback: rgba(16, 18, 28, 0.82);
  --dl-glass-border: rgba(255, 255, 255, 0.10);
  --dl-glass-inset: inset 0 1px 1px rgba(255, 255, 255, 0.16);
  --dl-glass-inset-soft: inset 0 1px 1px rgba(255, 255, 255, 0.10);
  /* Cap blur ≤16px (TMA GPU budget) */
  --dl-glass-blur: 16px;
  --dl-glass-blur-modal: 16px;
  --dl-glass-blur-card-lite: 10px;
  --dl-glass-blur-card-lite-tma: 8px;
  --dl-glass-saturate: 160%;
  --dl-glass-saturate-lite: 145%;
  --dl-glass-saturate-lite-tma: 140%;

  /* Accent palette */
  --dl-gold: #ffd166;
  --dl-cyan: #5cf0ff;
  --dl-mint: #2fffc1;
  --dl-coral: #ff4d6d;
  --dl-coral-soft: #ff8b9a;
  --dl-violet: #8b6cff;
  --dl-violet-soft: #c6a8ff;
  --dl-stone: #c4a574;

  /* Accent tints (borders / fills) */
  --dl-tint-gold-border: rgba(255, 209, 102, 0.28);
  --dl-tint-gold-bg: rgba(255, 209, 102, 0.08);
  --dl-tint-cyan-border: rgba(92, 240, 255, 0.35);
  --dl-tint-cyan-bg: rgba(92, 240, 255, 0.10);
  --dl-tint-cyan-bg-soft: rgba(92, 240, 255, 0.06);
  --dl-tint-mint-border: rgba(47, 255, 193, 0.28);
  --dl-tint-mint-bg: rgba(47, 255, 193, 0.08);
  --dl-tint-coral-border: rgba(255, 77, 109, 0.28);
  --dl-tint-coral-bg: rgba(255, 77, 109, 0.10);
  --dl-tint-coral-bg-strong: rgba(255, 77, 109, 0.14);
  --dl-tint-violet-border: rgba(139, 108, 255, 0.35);
  --dl-tint-violet-bg: rgba(139, 108, 255, 0.12);
  --dl-tint-violet-chain: rgba(198, 168, 255, 0.52);
  --dl-tint-violet-chain-soft: rgba(198, 168, 255, 0.28);

  /* Notes crystal piles (вексель packs) */
  --dl-crystal-glow: drop-shadow(0 0 5px rgba(92, 240, 255, 0.4));
  --dl-crystal-glow-rich: drop-shadow(0 0 7px rgba(255, 209, 102, 0.28)) drop-shadow(0 0 6px rgba(92, 240, 255, 0.55));

  /* Typography */
  --dl-font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --dl-text-primary: #fff;
  --dl-text-secondary: rgba(255, 255, 255, 0.62);
  --dl-text-muted: rgba(255, 255, 255, 0.42);
  --dl-kicker-size: 0.64rem;
  --dl-kicker-weight: 500;
  --dl-kicker-tracking: 0.16em;

  /* Motion */
  --dl-ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --dl-duration-fast: 0.18s;

  /* Spacing & radii */
  --dl-gap-page: 14px;
  --dl-radius-xl: 20px;
  --dl-radius-lg: 18px;
  --dl-radius-md: 16px;
  --dl-radius-sm: 14px;
  --dl-radius-xs: 12px;
  --dl-radius-pill: 999px;
  --dl-nav-offset: 85px;

  /* Page hubs (market / trading / shop) */
  --dl-hub-meta-gap: 10px;

  /* Overlays */
  --dl-backdrop: rgba(8, 10, 16, 0.78);

  /* Aurora (filter blur capped ≤16px) */
  --dl-blob-blur: 16px;
  --dl-blob-blur-mobile: 16px;
  --dl-blob-blur-tma: 16px;
  --dl-blob-drift-duration: 22s;

  /* Gradients */
  --dl-gradient-hero-text: linear-gradient(90deg, #7ef6ff 0%, #ffe08a 100%);
  --dl-gradient-capacity: linear-gradient(90deg, var(--dl-cyan), var(--dl-violet));

  /* Profile compat aliases (remove when pages migrate to --dl-*) */
  --pf-surface: var(--dl-surface);
  --pf-border: var(--dl-border);
  --pf-inset: var(--dl-glass-inset);
  --pf-gold: var(--dl-gold);
  --pf-cyan: var(--dl-cyan);
  --pf-mint: var(--dl-mint);
  --pf-coral: var(--dl-coral);
  --pf-violet: var(--dl-violet);
  --pf-spring: var(--dl-ease-spring);
  --pf-mono: var(--dl-font-mono);
}

/* ===== Route shell (themed pages) ===== */
body.dl-route,
body.profile-route,
body.player-view-route,
body.inventory-route,
body.trading-square-route,
body.withdraw-notes-route,
body.admin-route {
  background-color: var(--dl-bg-base) !important;
  background-image: var(--dl-bg-gradient-1), var(--dl-bg-gradient-2), var(--dl-bg-gradient-3);
}

body.dl-route .content-shell,
body.profile-route .content-shell,
body.player-view-route .content-shell,
body.inventory-route .content-shell,
body.trading-square-route .content-shell,
body.withdraw-notes-route .content-shell,
body.admin-route .content-shell {
  background: transparent;
  gap: 0;
  padding-bottom: 0;
}

body.dl-route,
body.profile-route,
body.player-view-route,
body.inventory-route,
body.trading-square-route,
body.withdraw-notes-route,
body.admin-route {
  padding-bottom: 0;
}

/* ===== Page container ===== */
.dl-page,
.profile-page {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: var(--dl-gap-page);
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  padding-top: 4px;
  padding-bottom: calc(var(--dl-nav-offset) + env(safe-area-inset-bottom, 20px));
}

.dl-page > *:not(.dl-aurora):not(.pf-aurora):not(dialog):not(.player-gift-overlay),
.profile-page > *:not(.dl-aurora):not(.pf-aurora):not(dialog):not(.player-gift-overlay) {
  position: relative;
  z-index: 1;
}

.dl-page input,
.dl-page textarea,
.dl-page code,
.profile-page input,
.profile-page textarea,
.profile-page code {
  -webkit-user-select: text;
  user-select: text;
}

/* ===== Utilities ===== */
.dl-visually-hidden,
.pf-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

/* ===== Aurora background ===== */
.dl-aurora,
.pf-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.dl-aurora::after,
.pf-aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0.7px, transparent 0.8px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 12%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 12%, #000 0%, transparent 72%);
}

.dl-blob,
.pf-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(var(--dl-blob-blur));
  will-change: transform;
  transform: translateZ(0);
  animation: dl-blob-drift var(--dl-blob-drift-duration) var(--dl-ease-spring) infinite alternate;
}

.dl-blob--cyan,
.pf-blob--cyan {
  width: 280px;
  height: 280px;
  top: -80px;
  left: 50%;
  margin-left: -140px;
  background: radial-gradient(circle, rgba(56, 189, 255, 0.55) 0%, transparent 70%);
}

.dl-blob--violet,
.pf-blob--violet {
  width: 240px;
  height: 240px;
  top: 18%;
  right: -70px;
  background: radial-gradient(circle, rgba(139, 108, 255, 0.48) 0%, transparent 70%);
  animation-delay: -7s;
}

.dl-blob--indigo,
.pf-blob--indigo {
  width: 260px;
  height: 260px;
  bottom: 12%;
  left: -80px;
  background: radial-gradient(circle, rgba(67, 56, 202, 0.42) 0%, transparent 70%);
  animation-delay: -13s;
}

@keyframes dl-blob-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(18px, 14px, 0) scale(1.12); }
}

/* ===== Typography helpers ===== */
.dl-kicker,
.pf-kicker,
.dl-page .stat-chip .label,
.profile-page .stat-chip .label,
.dl-page .sort-label,
.profile-page .sort-label {
  font-family: var(--dl-font-mono);
  font-size: var(--dl-kicker-size);
  font-weight: var(--dl-kicker-weight);
  letter-spacing: var(--dl-kicker-tracking);
  text-transform: uppercase;
  color: var(--dl-text-muted);
}

.dl-gradient-text,
.gradient-text {
  background: var(--dl-gradient-hero-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Dark Liquid Glass surface ===== */
.dl-page .glass,
.profile-page .glass {
  transform: none;
  isolation: auto;
  background-image: none !important;
}

.dl-page .glass::before,
.dl-page .glass::after,
.profile-page .glass::before,
.profile-page .glass::after {
  display: none !important;
}

.dl-glass,
.pf-glass,
.dl-page .pf-alert,
.profile-page .pf-alert,
.dl-page .pf-banner,
.profile-page .pf-banner,
.dl-page .ownership-alert,
.profile-page .ownership-alert,
.dl-page .stat-chip,
.profile-page .stat-chip,
.dl-page .no-slaves,
.profile-page .no-slaves,
.dl-page .sort-btn,
.profile-page .sort-btn,
.dl-page .character-card-mini,
.profile-page .character-card-mini {
  background: var(--dl-glass-bg);
  border: 1px solid var(--dl-glass-border);
  box-shadow: var(--dl-glass-inset);
  backdrop-filter: blur(var(--dl-glass-blur)) saturate(var(--dl-glass-saturate));
  -webkit-backdrop-filter: blur(var(--dl-glass-blur)) saturate(var(--dl-glass-saturate));
}

html.tg-webapp .dl-page .glass,
html.tg-webapp .profile-page .glass,
html.tg-webapp .dl-page .dl-glass,
html.tg-webapp .profile-page .pf-glass,
html.tg-webapp .dl-page .pf-alert,
html.tg-webapp .profile-page .pf-alert,
html.tg-webapp .dl-page .pf-banner,
html.tg-webapp .profile-page .pf-banner,
html.tg-webapp .dl-page .ownership-alert,
html.tg-webapp .profile-page .ownership-alert,
html.tg-webapp .dl-page .stat-chip,
html.tg-webapp .profile-page .stat-chip,
html.tg-webapp .dl-page .no-slaves,
html.tg-webapp .profile-page .no-slaves,
html.tg-webapp .dl-page .sort-btn,
html.tg-webapp .profile-page .sort-btn,
html.tg-webapp .dl-page .character-card-mini,
html.tg-webapp .profile-page .character-card-mini {
  background: var(--dl-glass-bg) !important;
  background-image: none !important;
  border: 1px solid var(--dl-glass-border) !important;
  box-shadow: var(--dl-glass-inset) !important;
  backdrop-filter: blur(var(--dl-glass-blur)) saturate(var(--dl-glass-saturate)) !important;
  -webkit-backdrop-filter: blur(var(--dl-glass-blur)) saturate(var(--dl-glass-saturate)) !important;
}

html.tg-webapp .profile-page .character-card-mini.is-you,
html.tg-webapp .dl-page .character-card-mini.is-you,
.profile-page .character-card-mini.is-you,
.dl-page .character-card-mini.is-you {
  border: 1px solid var(--dl-mint) !important;
  background: var(--dl-tint-mint-bg) !important;
  box-shadow:
    var(--dl-glass-inset),
    0 0 14px rgba(47, 255, 193, 0.18) !important;
}

/* Inset panel (modals, notes, choices) */
.dl-surface-inset,
.pf-dialog .value-display,
.pf-dialog .price-info,
.pf-dialog .chain-info,
.pf-dialog .upgrade-info,
.pf-dialog .warning-info,
.pf-dialog .chain-choice-option,
.dl-dialog .dl-surface-inset {
  border-radius: var(--dl-radius-sm);
  padding: 12px;
  border: 1px solid var(--dl-border);
  box-shadow: var(--dl-glass-inset-soft);
  background: var(--dl-surface-raised);
}

/* ===== Tactile press ===== */
.dl-press,
.pf-press,
.clickable-player,
.market-card-clickable {
  transform: translateZ(0);
  transition:
    transform var(--dl-duration-fast) var(--dl-ease-spring),
    opacity var(--dl-duration-fast) ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.dl-page .dl-press:active:not(:disabled),
.dl-route .dl-press:active:not(:disabled),
.dl-page .pf-press:active:not(:disabled),
.dl-route .pf-press:active:not(:disabled),
.profile-page .pf-press:active:not(:disabled),
.profile-route .pf-press:active:not(:disabled),
.dl-page .btn.dl-press:active:not(:disabled),
.dl-route .btn.dl-press:active:not(:disabled),
.dl-page .btn.pf-press:active:not(:disabled),
.dl-route .btn.pf-press:active:not(:disabled),
.profile-page .btn.pf-press:active:not(:disabled),
.profile-route .btn.pf-press:active:not(:disabled),
.market-route .pf-press:active:not(:disabled),
.rating-route .pf-press:active:not(:disabled),
.player-view-route .pf-press:active:not(:disabled),
.dl-page .stat-chip:active,
.dl-route .stat-chip:active,
.profile-page .stat-chip:active,
.profile-route .stat-chip:active,
.player-view-route .stat-chip:active,
.dl-page .sort-btn:active,
.dl-route .sort-btn:active,
.profile-page .sort-btn:active,
.profile-route .sort-btn:active,
.player-view-route .sort-btn:active,
.dl-page .character-card-mini.pf-press:active,
.dl-route .character-card-mini.pf-press:active,
.profile-page .character-card-mini.pf-press:active,
.profile-route .character-card-mini.pf-press:active,
.player-view-route .character-card-mini.pf-press:active,
.clickable-player:active,
.market-card-clickable:active,
.market-route .market-buy-btn:active:not(:disabled),
.rating-route .rating-nav-btn:active:not(:disabled),
.pv-back-link.pf-press:active,
.bottom-nav a:active,
.bottom-nav button:active {
  transform: scale(0.98);
  filter: brightness(1.12);
}

/* ===== Icons (Lucide inline SVG) ===== */
.dl-ico,
.pf-ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.18em;
  overflow: visible;
}

.dl-ico--inline,
.pf-ico--inline { width: 0.95em; height: 0.95em; }

.dl-ico--sm,
.pf-ico--sm { width: 0.85em; height: 0.85em; }

.dl-ico--stat,
.pf-ico--stat {
  width: 1.12em;
  height: 1.12em;
  margin-left: 4px;
}

.pf-asset-ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.18em;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(196, 165, 116, 0.45));
}

.pf-asset-ico--inline { width: 0.95em; height: 0.95em; }

.pf-asset-ico--stat {
  width: 1.12em;
  height: 1.12em;
  margin-left: 4px;
}

.pf-asset-ico--gold {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4));
}

.pf-asset-ico--frames {
  filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.45));
}

.dl-ico--gold,
.pf-ico--gold {
  color: var(--dl-gold);
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.4));
}

.dl-ico--cyan,
.pf-ico--cyan {
  color: var(--dl-cyan);
  filter: drop-shadow(0 0 6px rgba(92, 240, 255, 0.45));
}

.dl-ico--mint,
.pf-ico--mint {
  color: var(--dl-mint);
  filter: drop-shadow(0 0 6px rgba(47, 255, 193, 0.4));
}

.dl-ico--coral,
.pf-ico--coral {
  color: var(--dl-coral-soft);
  filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.4));
}

.dl-ico--violet,
.pf-ico--violet {
  color: var(--dl-violet-soft);
  filter: drop-shadow(0 0 6px rgba(139, 108, 255, 0.4));
}

.dl-ico--stone,
.pf-ico--stone {
  color: var(--dl-stone);
  filter: drop-shadow(0 0 6px rgba(196, 165, 116, 0.45));
}

.dl-ico--bounce,
.pf-ico--bounce {
  transform: translateZ(0);
  animation: dl-coin-bounce 1.7s ease-in-out infinite;
}

.dl-ico--pulse,
.pf-ico--pulse {
  transform: translateZ(0);
  animation: dl-trend-pulse 2.4s ease-in-out infinite;
}

@keyframes dl-coin-bounce {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -2px, 0); }
}

@keyframes dl-trend-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.dl-ico-wrap,
.pf-ico-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dl-ico-wrap .dl-ico,
.dl-ico-wrap .pf-ico,
.pf-ico-wrap .pf-ico { width: 1.15em; height: 1.15em; }

.dl-ico-wrap--gold,
.pf-ico-wrap--gold { color: var(--dl-gold); }
.dl-ico-wrap--cyan,
.pf-ico-wrap--cyan { color: var(--dl-cyan); }
.dl-ico-wrap--mint,
.pf-ico-wrap--mint { color: var(--dl-mint); }
.dl-ico-wrap--coral,
.pf-ico-wrap--coral { color: var(--dl-coral-soft); }
.dl-ico-wrap--violet,
.pf-ico-wrap--violet { color: var(--dl-violet-soft); }
.dl-ico-wrap--stone,
.pf-ico-wrap--stone { color: var(--dl-stone); }

/* ===== Notes crystal piles (tiered value) ===== */
.notes-pile {
  position: relative;
  width: 96px;
  height: 52px;
  flex-shrink: 0;
}

.notes-pile__gem {
  position: absolute;
  display: flex;
  width: 28px;
  height: 28px;
  color: var(--dl-cyan);
}

.notes-pile__gem .pf-ico,
.notes-pile__gem .dl-ico {
  width: 100%;
  height: 100%;
  vertical-align: 0;
}

.notes-pile__gem:nth-child(1) .pf-ico { animation-delay: 0s; }
.notes-pile__gem:nth-child(2) .pf-ico { animation-delay: 0.12s; }
.notes-pile__gem:nth-child(3) .pf-ico { animation-delay: 0.24s; }
.notes-pile__gem:nth-child(4) .pf-ico { animation-delay: 0.08s; }
.notes-pile__gem:nth-child(5) .pf-ico { animation-delay: 0.2s; }
.notes-pile__gem:nth-child(6) .pf-ico { animation-delay: 0.32s; }

/* t1 — 40: один кристалл */
.notes-pile--t1 .notes-pile__gem:nth-child(1) {
  width: 34px;
  height: 34px;
  left: 31px;
  top: 9px;
}

/* t2 — 90: два рядом */
.notes-pile--t2 .notes-pile__gem:nth-child(1) { left: 18px; top: 12px; z-index: 1; }
.notes-pile--t2 .notes-pile__gem:nth-child(2) { left: 50px; top: 12px; z-index: 2; }

/* t3 — 200: два сверху, один снизу */
.notes-pile--t3 .notes-pile__gem:nth-child(1) { left: 18px; top: 0; z-index: 1; }
.notes-pile--t3 .notes-pile__gem:nth-child(2) { left: 50px; top: 0; z-index: 2; }
.notes-pile--t3 .notes-pile__gem:nth-child(3) { left: 34px; top: 22px; z-index: 3; }

/* t4 — 400: три сверху, один снизу */
.notes-pile--t4 .notes-pile__gem { width: 24px; height: 24px; }
.notes-pile--t4 .notes-pile__gem:nth-child(1) { left: 10px; top: 0; z-index: 1; }
.notes-pile--t4 .notes-pile__gem:nth-child(2) { left: 36px; top: 0; z-index: 2; }
.notes-pile--t4 .notes-pile__gem:nth-child(3) { left: 62px; top: 0; z-index: 3; }
.notes-pile--t4 .notes-pile__gem:nth-child(4) { left: 36px; top: 22px; z-index: 4; }

/* t5 — 850: три сверху, два снизу */
.notes-pile--t5 .notes-pile__gem { width: 24px; height: 24px; }
.notes-pile--t5 .notes-pile__gem:nth-child(1) { left: 10px; top: 0; z-index: 1; }
.notes-pile--t5 .notes-pile__gem:nth-child(2) { left: 36px; top: 0; z-index: 2; }
.notes-pile--t5 .notes-pile__gem:nth-child(3) { left: 62px; top: 0; z-index: 3; }
.notes-pile--t5 .notes-pile__gem:nth-child(4) { left: 22px; top: 22px; z-index: 4; }
.notes-pile--t5 .notes-pile__gem:nth-child(5) { left: 50px; top: 22px; z-index: 5; }

/* t6 — 1500: три сверху, три снизу */
.notes-pile--t6 .notes-pile__gem { width: 24px; height: 24px; }
.notes-pile--t6 .notes-pile__gem .pf-ico--cyan,
.notes-pile--t6 .notes-pile__gem .dl-ico--cyan {
  color: #d4fbff;
}
.notes-pile--t6 .notes-pile__gem:nth-child(1) { left: 10px; top: 0; z-index: 1; }
.notes-pile--t6 .notes-pile__gem:nth-child(2) { left: 36px; top: 0; z-index: 2; }
.notes-pile--t6 .notes-pile__gem:nth-child(3) { left: 62px; top: 0; z-index: 3; }
.notes-pile--t6 .notes-pile__gem:nth-child(4) { left: 10px; top: 22px; z-index: 4; }
.notes-pile--t6 .notes-pile__gem:nth-child(5) { left: 36px; top: 22px; z-index: 5; }
.notes-pile--t6 .notes-pile__gem:nth-child(6) { left: 62px; top: 22px; z-index: 6; }

/* ===== Dialog shell ===== */
.dl-dialog,
.pf-dialog,
#inventory-view-modal,
.present-detail-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: none;
  background: transparent !important;
  color: var(--dl-text-primary);
  box-sizing: border-box;
  display: none;
  align-items: center;
  justify-content: center;
  transform: none;
}

.dl-dialog[open],
.pf-dialog[open],
#inventory-view-modal[open],
.present-detail-modal[open] {
  display: flex !important;
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  z-index: 2000;
}

.dl-dialog::backdrop,
.pf-dialog::backdrop,
#inventory-view-modal::backdrop,
.present-detail-modal::backdrop {
  background: var(--dl-backdrop);
}

.dl-dialog .modal-content,
.pf-dialog .modal-content,
#inventory-view-modal .inventory-view-modal-content,
.present-detail-modal .present-detail-modal-content {
  width: min(340px, 90vw);
  max-width: 90vw;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--dl-glass-border);
  box-shadow: var(--dl-glass-inset);
  border-radius: var(--dl-radius-xl);
  text-align: center;
  background: var(--dl-glass-bg-modal) !important;
  background-image: none !important;
  color: var(--dl-text-primary);
  backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate)) !important;
  -webkit-backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate)) !important;
  box-sizing: border-box;
}

html.tg-webapp .dl-dialog .modal-content,
html.tg-webapp .pf-dialog .modal-content,
html.tg-webapp #inventory-view-modal .inventory-view-modal-content,
html.tg-webapp .present-detail-modal .present-detail-modal-content {
  background: var(--dl-glass-bg-modal) !important;
  background-image: none !important;
  backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate)) !important;
  -webkit-backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate)) !important;
  box-shadow: var(--dl-glass-inset) !important;
}

.dl-dialog .modal-content::before,
.dl-dialog .modal-content::after,
.pf-dialog .modal-content::before,
.pf-dialog .modal-content::after {
  display: none !important;
}

/* Dialog buttons */
.dl-dialog .btn[hidden],
.pf-dialog .btn[hidden],
#inventory-view-modal .btn[hidden],
.present-detail-modal .btn[hidden] {
  display: none !important;
}

.dl-dialog .btn,
.pf-dialog .btn,
#inventory-view-modal .btn,
.present-detail-modal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--dl-border) !important;
  box-shadow: var(--dl-glass-inset-soft) !important;
  color: var(--dl-text-primary) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: var(--dl-radius-sm) !important;
}

.dl-dialog .btn::before,
.pf-dialog .btn::before,
#inventory-view-modal .btn::before,
.present-detail-modal .btn::before { display: none !important; }

.dl-dialog .btn.primary,
.pf-dialog .btn.primary,
#inventory-view-modal .btn.secondary {
  background: var(--dl-tint-cyan-bg) !important;
  border-color: var(--dl-tint-cyan-border) !important;
  color: var(--dl-cyan) !important;
}

.dl-dialog .btn.accent,
.pf-dialog .btn.accent {
  background: var(--dl-tint-violet-bg) !important;
  border-color: var(--dl-tint-violet-border) !important;
  color: var(--dl-violet-soft) !important;
}

.dl-dialog .btn.warning,
.pf-dialog .btn.warning {
  background: var(--dl-tint-coral-bg) !important;
  border-color: rgba(255, 77, 109, 0.38) !important;
  color: var(--dl-coral-soft) !important;
}

.dl-dialog .btn.ghost,
.pf-dialog .btn.ghost,
.present-detail-modal .btn.ghost {
  background: rgba(255, 255, 255, 0.03) !important;
  color: rgba(255, 255, 255, 0.78) !important;
}

.dl-dialog .btn:active:not(:disabled),
.pf-dialog .btn:active:not(:disabled),
#inventory-view-modal .btn:active,
.present-detail-modal .btn:active {
  transform: scale(0.98);
}

.dl-dialog h3,
.pf-dialog h3 {
  margin: 0 0 10px;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--dl-text-primary);
}

.dl-dialog p,
.pf-dialog p {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--dl-text-secondary);
  line-height: 1.4;
}

.dl-dialog strong,
.pf-dialog strong { color: var(--dl-text-primary); }

.dl-dialog .modal-buttons,
.pf-dialog .modal-buttons { display: flex; gap: 8px; }

.dl-dialog .modal-buttons .btn,
.pf-dialog .modal-buttons .btn { flex: 1; padding: 11px 10px; }

.dl-dialog .icon.close,
.pf-dialog .icon.close,
#referral-modal .icon.close,
#character-modal .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0 !important;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--dl-border);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  font-family: Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
}

.pf-dialog .value-display {
  font-size: clamp(0.85rem, 4vw, 1.35rem);
  font-weight: 700;
  word-break: break-word;
  color: var(--dl-text-primary);
  margin-bottom: 12px;
}

.pf-dialog .price-info { font-size: 1.08rem; font-weight: 700; color: var(--dl-text-primary); margin-bottom: 12px; }
.pf-dialog .price-info--mint { color: var(--dl-mint); border-color: var(--dl-tint-mint-border); background: var(--dl-tint-mint-bg); }
.pf-dialog .price-info--gold { color: var(--dl-gold); border-color: var(--dl-tint-gold-border); background: var(--dl-tint-gold-bg); }
.pf-dialog .price-info--coral { color: var(--dl-coral-soft); border-color: var(--dl-tint-coral-border); background: var(--dl-tint-coral-bg); }

.pf-dialog .balance-info {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dl-text-secondary);
}

.pf-dialog .balance-info strong {
  color: var(--dl-text-primary);
  font-weight: 700;
}

.pf-dialog .chain-info,
.pf-dialog .upgrade-info { text-align: left; font-size: 0.78rem; margin-bottom: 12px; }

.pf-dialog .chain-info p,
.pf-dialog .upgrade-info p { margin: 4px 0; font-size: 0.78rem; color: rgba(255, 255, 255, 0.82); }

.pf-choice-label {
  margin: 0 0 8px !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: rgba(255, 255, 255, 0.45) !important;
}

.pf-dialog .chain-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  text-align: left;
}

.pf-dialog .chain-choice-option {
  display: grid;
  grid-template-columns: 18px 32px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 12px 14px;
  min-height: 64px;
  cursor: pointer;
  color: var(--dl-text-primary);
  transition: transform var(--dl-duration-fast) var(--dl-ease-spring);
}

.pf-dialog .chain-choice-option.selected {
  border-color: rgba(92, 240, 255, 0.4);
  background: var(--dl-tint-cyan-bg);
}

.pf-dialog .chain-choice-option input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  flex-shrink: 0;
}

.pf-dialog .chain-choice-option input:checked {
  border-color: var(--dl-cyan);
  box-shadow: inset 0 0 0 4px var(--dl-cyan);
}

.pf-dialog .chain-choice-option__ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.pf-dialog .chain-choice-option__ico .pf-ico {
  width: 18px;
  height: 18px;
}

.pf-dialog .chain-choice-option__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.pf-dialog .chain-choice-option__title {
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--dl-text-primary);
}

.pf-dialog .chain-choice-option__meta {
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--textSecondary, rgba(255, 255, 255, 0.62));
}

.pf-dialog .chain-choice-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.pf-dialog .insufficient-balance-msg {
  display: none;
  background: var(--dl-tint-coral-bg-strong);
  border: 1px solid rgba(255, 77, 109, 0.38);
  border-radius: var(--dl-radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.pf-dialog .insufficient-balance-msg.show { display: block; }

.pf-dialog .insufficient-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dl-coral-soft);
}

.pf-dialog .insufficient-row {
  margin: 0.35rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dl-text-primary);
}

/* ===== Accent note blocks (alerts, banners) ===== */
.dl-note,
.pf-alert-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: var(--dl-radius-xs);
  border: 1px solid var(--dl-border);
  box-shadow: var(--dl-glass-inset);
  font-size: 0.8rem;
}

.dl-note span,
.pf-alert-note span { color: var(--textSecondary); font-size: 0.75rem; }

.dl-note--gold,
.pf-alert-note--gold { color: var(--dl-gold); border-color: var(--dl-tint-gold-border); }

.dl-note--coral,
.pf-alert-note--coral { color: var(--dl-coral); border-color: var(--dl-tint-coral-border); }

.dl-note--mint,
.pf-alert-note--mint { color: var(--dl-mint); border-color: var(--dl-tint-mint-border); }

/* ===== Fallbacks & accessibility ===== */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dl-glass,
  .pf-glass,
  .dl-page .pf-alert,
  .profile-page .pf-alert,
  .dl-page .stat-chip,
  .profile-page .stat-chip,
  .dl-page .character-card-mini,
  .profile-page .character-card-mini,
  .dl-dialog .modal-content,
  .pf-dialog .modal-content {
    background: var(--dl-glass-bg-fallback) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dl-blob,
  .pf-blob { animation: none; }
  .dl-ico--bounce,
  .dl-ico--pulse,
  .pf-ico--bounce,
  .pf-ico--pulse { animation: none; }
  .dl-press,
  .pf-press,
  .clickable-player,
  .market-card-clickable { transition: none; }
  .dl-press:active:not(:disabled),
  .pf-press:active:not(:disabled),
  .clickable-player:active,
  .market-card-clickable:active { transform: none; filter: none; }
}

/* Aurora: static on phones / TMA */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .dl-blob,
  .pf-blob {
    filter: blur(var(--dl-blob-blur-mobile));
    animation: none !important;
    will-change: auto;
  }
  .dl-blob--indigo,
  .pf-blob--indigo { display: none; }
}

html.tg-webapp .dl-blob,
html.tg-webapp .pf-blob {
  filter: blur(var(--dl-blob-blur-tma));
  animation: none !important;
  will-change: auto;
}

html.tg-webapp .dl-blob--indigo,
html.tg-webapp .pf-blob--indigo { display: none; }

/* ===== Shared confirm dialog ===== */
.dl-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
  background: var(--dl-backdrop, rgba(4, 6, 12, 0.72));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
  pointer-events: none;
}

.dl-confirm-overlay.show {
  display: flex;
  pointer-events: auto;
}

.dl-confirm-overlay[hidden] {
  display: none !important;
}

body.dl-confirm-open {
  overflow: hidden;
}

.dl-confirm-modal {
  width: min(92%, 340px);
  padding: 1.2rem 1.05rem 1rem;
  border-radius: var(--dl-radius-xl);
  border: 1px solid var(--dl-glass-border);
  background: var(--dl-glass-bg-modal);
  color: var(--dl-text-primary);
  box-shadow: var(--dl-glass-inset), 0 18px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate));
  -webkit-backdrop-filter: blur(var(--dl-glass-blur-modal)) saturate(var(--dl-glass-saturate));
  text-align: center;
  box-sizing: border-box;
}

html.tg-webapp .dl-confirm-modal {
  background: rgba(12, 14, 22, 0.96);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.dl-confirm-modal__message {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--dl-text-primary);
}

.dl-confirm-modal__message .dl-confirm-ico,
.dl-confirm-modal__message .pf-ico {
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  margin: 0 0.08em;
}

.dl-confirm-modal__message .gift-name-rarity {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.dl-confirm-modal__message .gift-name-rarity.rarity-common { color: var(--rarity-border-common, #5cf0ff); }
.dl-confirm-modal__message .gift-name-rarity.rarity-uncommon,
.dl-confirm-modal__message .gift-name-rarity.rarity-rare { color: var(--rarity-border-rare, #8b6cff); }
.dl-confirm-modal__message .gift-name-rarity.rarity-unique { color: var(--rarity-border-unique, #ff4d6d); }
.dl-confirm-modal__message .gift-name-rarity.rarity-limited { color: var(--rarity-border-limited, #ffd166); }

.dl-confirm-muted {
  color: var(--dl-text-muted, rgba(255, 255, 255, 0.55));
  font-weight: 500;
}

.dl-confirm-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.dl-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--dl-radius-xs);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--dl-glass-inset-soft);
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
  transition: transform var(--dl-duration-fast) var(--dl-ease-spring);
}

.dl-confirm-btn:active {
  transform: scale(0.97);
}

.dl-confirm-btn--ghost {
  border: 1px solid var(--dl-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dl-text-secondary);
}

.dl-confirm-btn--primary {
  border: 1px solid rgba(92, 240, 255, 0.34);
  background: rgba(92, 240, 255, 0.12);
  color: var(--dl-cyan);
}

.dl-confirm-btn--primary:active {
  background: rgba(92, 240, 255, 0.18);
}

/* Equipped present as Telegram-style status next to nickname.
   Use block-level flex (not inline-flex) so siblings like rating balance
   stay on the next line — inline-flex + inline-flex balance sat side-by-side. */
.username-line {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-start;
  gap: 0.22em;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.15;
}

.username-line > :not(.username-present-status-wrap):not(.username-present-status) {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.username-present-status-wrap {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 0.92em !important;
  width: 0.92em !important;
  height: 0.92em !important;
  max-width: 0.92em !important;
  max-height: 0.92em !important;
  overflow: visible !important;
  line-height: 0;
  position: relative;
}

/* Equipped gift next to nick: never show ambient glow */
.username-present-status-wrap::before {
  content: none !important;
  display: none !important;
}

/* Sub-layer ambient glow hugs the SVG box, not the card */
.pack-icon-wrapper,
.present-neon {
  --pack-glow-core: rgba(192, 132, 252, 0.35);
  --pack-glow-mid: rgba(147, 51, 234, 0.15);
  --present-glow: #c084fc;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  isolation: isolate;
}

.pack-icon-wrapper::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: 1;
  background: radial-gradient(
    circle,
    var(--pack-glow-core) 0%,
    var(--pack-glow-mid) 45%,
    transparent 70%
  );
  filter: blur(14px);
  border-radius: 50%;
  pointer-events: none;
  transform: translateZ(0);
}

.present-neon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110%;
  height: 110%;
  transform: translate(-50%, -50%);
  z-index: 1;
  background: radial-gradient(circle, var(--present-glow) 0%, transparent 70%);
  filter: blur(3px);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.55;
}

.pack-icon-wrapper--top {
  --pack-glow-core: rgba(245, 158, 11, 0.35);
  --pack-glow-mid: rgba(217, 119, 6, 0.14);
}

.pack-icon-wrapper--top::before {
  background: radial-gradient(
    circle,
    rgba(245, 158, 11, 0.35) 0%,
    rgba(217, 119, 6, 0.14) 45%,
    transparent 70%
  );
}

.pack-icon-wrapper > img,
.pack-icon-wrapper > svg,
.pack-icon-wrapper > .pf-ico,
.present-neon > img,
.present-neon > .username-present-status,
.present-neon > .gift-modal-item-preview__media,
.username-present-status-wrap .username-present-status {
  position: relative;
  z-index: 2;
  filter: none !important;
}

/* Custom nick color: recolor SVG silhouette; glow stays on ::before */
.present-neon--nick .username-present-status,
.username-present-status-wrap.present-neon--nick .username-present-status {
  opacity: 0;
  filter: none !important;
}

.present-neon--nick::after,
.username-present-status-wrap.present-neon--nick::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--present-fill, var(--present-glow));
  -webkit-mask-image: var(--present-mask);
  mask-image: var(--present-mask);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  z-index: 2;
  pointer-events: none;
  filter: none;
}

.gift-modal-item-preview .present-neon {
  flex: 0 0 auto;
  width: auto;
  height: auto;
}

.shop-item-preview--present.present-neon,
.profile-slot-preview.present-neon,
.inv-card-icon-present.present-neon,
.present-detail-icon.present-neon,
.inventory-presents-all-item__icon.present-neon {
  display: flex;
}

.username-present-status-wrap--sm,
.username-present-status-wrap.username-present-status--sm {
  flex-basis: 0.88em !important;
  width: 0.88em !important;
  height: 0.88em !important;
  max-width: 0.88em !important;
  max-height: 0.88em !important;
}

.username-present-status-wrap .username-present-status {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: none !important;
}

.card-name-line,
.market-card-name-line,
.buyout-history-name-line {
  max-width: 100%;
}

.podium-v2__name.username-line {
  justify-content: center;
  width: 100%;
}

/* Hero nickname: status = glyph size of the name */
.profile-page .hero-info h1.username-line,
.player-view-wrap .hero-info h1.username-line,
.player-view-wrap .pv-name-tg-wrap .pv-name-tg.username-line {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.22em;
}

.profile-page .hero-info h1 .username-present-status-wrap,
.player-view-wrap .hero-info h1 .username-present-status-wrap {
  flex: 0 0 0.92em !important;
  width: 0.92em !important;
  height: 0.92em !important;
  max-width: 0.92em !important;
  max-height: 0.92em !important;
}

@media (prefers-reduced-motion: reduce) {
  .dl-confirm-btn:active {
    transform: none;
  }
}

/* Mobile global shadow kill — restore glass rim on themed pages */
@media (max-width: 900px) {
  .dl-page .dl-glass,
  .dl-page .pf-glass,
  .profile-page .pf-glass,
  .dl-page .pf-alert,
  .profile-page .pf-alert,
  .dl-page .pf-banner,
  .profile-page .pf-banner,
  .dl-page .ownership-alert,
  .profile-page .ownership-alert,
  .dl-page .stat-chip,
  .profile-page .stat-chip,
  .dl-page .no-slaves,
  .profile-page .no-slaves,
  .dl-page .sort-btn,
  .profile-page .sort-btn,
  .dl-page .character-card-mini,
  .profile-page .character-card-mini {
    box-shadow: var(--dl-glass-inset) !important;
  }
}

/* ===== List card isolation (rating / slaves / inventory / shop) ===== */
.character-card-mini,
.rating-page-wrap .rating-row:not(.head),
.rating-page-wrap .podium-v2__card,
.inventory-strip-card,
.shop-item-card,
.shop-cosmetic-card {
  contain: content;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.shop-item-card.shop-item-card--name-color,
.inventory-strip-card.shop-item-card--name-color {
  /* Name-color cards need uncontained paint for gradient text */
  contain: layout style;
  transform: none;
  backface-visibility: visible;
}

.dl-page .card-grid-compact,
.profile-page .card-grid-compact,
.inventory-strip,
.shop-items-grid {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Shared buy buttons (market + player_view) */
.market-buy-btn {
  width: 100%;
  padding: 9px 10px;
  font-size: 0.78rem;
  border-radius: var(--dl-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}

.market-buy-btn .pf-ico {
  width: 14px;
  height: 14px;
}

.market-buy-btn .market-insufficient-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.market-buy-btn.primary {
  background: var(--dl-tint-cyan-bg) !important;
  border: 1px solid var(--dl-tint-cyan-border) !important;
  color: var(--dl-cyan) !important;
  box-shadow: var(--dl-glass-inset) !important;
}

.market-buy-btn.disabled {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--dl-text-secondary) !important;
  cursor: not-allowed;
  border: 1px solid var(--dl-border) !important;
}

.market-buy-btn.disabled.insufficient-funds {
  cursor: pointer;
}

.market-buy-btn.owned {
  background: rgba(47, 255, 193, 0.12) !important;
  color: var(--dl-mint) !important;
  cursor: default;
  border: 1px solid var(--dl-tint-mint-border) !important;
}

.market-buy-btn.owner {
  background: rgba(139, 108, 255, 0.12) !important;
  color: var(--dl-violet-soft) !important;
  cursor: default;
  border: 1px solid var(--dl-tint-violet-border) !important;
}
