/**
 * 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);

  /* Secret Agent / Mystery Spin — редкости = токены проекта */
  --dl-mystery-violet: #9b6cff;
  --dl-mystery-gold: #ffd166;
  --dl-mystery-border: linear-gradient(135deg, rgba(155, 108, 255, 0.85), rgba(255, 209, 102, 0.9));
  --dl-mystery-glow-common: var(--rarity-border-common, #5cf0ff);
  --dl-mystery-glow-rare: var(--rarity-border-rare, #8b6cff);
  --dl-mystery-glow-legendary: var(--rarity-border-limited, #ffd166);
  --dl-mystery-spin-ease: cubic-bezier(0.04, 0.94, 0.06, 1);
  --dl-mystery-spin-duration: 12s;
  --dl-mystery-q-gradient: linear-gradient(135deg, #5cf0ff 0%, #8b6cff 45%, #ffd166 100%);

  /* 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(.ch-sheet):not(.player-gift-overlay),
.profile-page > *:not(.dl-aurora):not(.pf-aurora):not(dialog):not(.ch-sheet):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: 600;
  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;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: none;
  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;
  color: inherit;
}

.dl-confirm-overlay.show,
.dl-confirm-overlay[open] {
  display: flex !important;
  pointer-events: auto;
}

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

.dl-confirm-overlay::backdrop {
  background: transparent;
}

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

.dl-confirm-modal {
  width: min(92%, 340px);
  max-width: 100%;
  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;
  overflow: hidden;
}

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-strong {
  color: var(--dl-cyan);
  font-weight: 700;
}

/* ===== Градации щитов: бронза / серебро / золото ===== */
.shield-grade-bronze {
  --shield-accent: #cf8a42;
  --shield-glow: rgba(207, 138, 66, 0.42);
  --shield-border: rgba(207, 138, 66, 0.38);
  --shield-bg: rgba(207, 138, 66, 0.1);
}

.shield-grade-silver {
  --shield-accent: #cdd8e4;
  --shield-glow: rgba(205, 216, 228, 0.42);
  --shield-border: rgba(205, 216, 228, 0.34);
  --shield-bg: rgba(205, 216, 228, 0.09);
}

.shield-grade-gold {
  --shield-accent: #ffd166;
  --shield-glow: rgba(255, 209, 102, 0.42);
  --shield-border: var(--dl-tint-gold-border);
  --shield-bg: var(--dl-tint-gold-bg);
}

.shield-notify-name {
  font-weight: 700;
  color: var(--shield-accent, var(--dl-cyan));
}

.dl-confirm-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.dl-confirm-modal__actions.is-triple {
  grid-template-columns: 1fr 1fr;
}

.dl-confirm-modal__actions.is-triple [data-dl-confirm="alt"] {
  order: 1;
}

.dl-confirm-modal__actions.is-triple [data-dl-confirm="ok"] {
  order: 2;
}

.dl-confirm-modal__actions.is-triple [data-dl-confirm="cancel"] {
  order: 3;
  grid-column: 1 / -1;
}

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

.dl-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 2.55rem;
  padding: 0.65rem 0.55rem;
  border-radius: var(--dl-radius-xs);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  cursor: pointer;
  box-sizing: border-box;
  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:focus-visible {
  box-shadow:
    var(--dl-glass-inset-soft),
    inset 0 0 0 1px rgba(46, 242, 255, 0.35);
}

.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. */
.username-line {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  line-height: 1.2;
  vertical-align: middle;
}

.username-line > :not(.username-present-status-wrap):not(.username-present-status):not(.premium-p-badge):not(.you-badge) {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  line-height: 1.25;
  padding: 0.12em 0;
}

.username-line,
.inventory-stage__name,
.rating-name-line,
.podium-v2__name,
.card-name-line,
.market-card-name-line,
.buyout-history-name-line {
  --uf-status-size: calc(1em * var(--uf-scale, 1));
}

.username-present-status-wrap {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--uf-status-size, 1em) !important;
  flex-shrink: 0 !important;
  width: var(--uf-status-size, 1em) !important;
  height: var(--uf-status-size, 1em) !important;
  max-width: var(--uf-status-size, 1em) !important;
  max-height: var(--uf-status-size, 1em) !important;
  overflow: visible !important;
  line-height: 0;
  position: relative;
  align-self: center;
  vertical-align: middle;
}

/* Optical center of letters sits above the em-box center (descenders + line-height). */
.username-line:has(.username-font) > .username-present-status-wrap,
.inventory-stage__name:has(.username-font) > .username-present-status-wrap,
.rating-name-line:has(.username-font) > .username-present-status-wrap,
.podium-v2__name:has(.username-font) > .username-present-status-wrap {
  transform: translateY(-0.08em);
}

/* Premium VIP badge: крупнее; plate=currentColor, VIP=#fff */
.username-present-status-wrap--premium-badge {
  --uf-status-size: calc(1.28em * var(--uf-scale, 1)) !important;
  flex: 0 0 var(--uf-status-size) !important;
  width: var(--uf-status-size) !important;
  height: var(--uf-status-size) !important;
  max-width: var(--uf-status-size) !important;
  max-height: var(--uf-status-size) !important;
  transform: translateY(0.08em);
  filter: drop-shadow(0 0 3px var(--premium-badge-glow, rgba(92, 240, 255, 0.4)));
}

.username-line:has(.username-font--cyrillicgoth) > .username-present-status-wrap--premium-badge,
.inventory-stage__name:has(.username-font--cyrillicgoth) > .username-present-status-wrap--premium-badge,
.rating-name-line:has(.username-font--cyrillicgoth) > .username-present-status-wrap--premium-badge,
.podium-v2__name:has(.username-font--cyrillicgoth) > .username-present-status-wrap--premium-badge {
  transform: translateY(0.04em);
}

.username-present-status-wrap--premium-badge .premium-badge-icon {
  display: block;
  width: 100% !important;
  height: 100% !important;
  overflow: visible;
}

/* 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 {
  --uf-status-size: calc(0.88em * var(--uf-scale, 1));
  flex-basis: var(--uf-status-size) !important;
  width: var(--uf-status-size) !important;
  height: var(--uf-status-size) !important;
  max-width: var(--uf-status-size) !important;
  max-height: var(--uf-status-size) !important;
}

.username-present-status-wrap .username-present-status,
.username-present-status-wrap .premium-badge-icon {
  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: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  vertical-align: middle;
}

.profile-page .hero-info h1 .username-present-status-wrap,
.player-view-wrap .hero-info h1 .username-present-status-wrap {
  flex: 0 0 var(--uf-status-size, 1em) !important;
  flex-shrink: 0 !important;
  width: var(--uf-status-size, 1em) !important;
  height: var(--uf-status-size, 1em) !important;
  max-width: var(--uf-status-size, 1em) !important;
  max-height: var(--uf-status-size, 1em) !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 {
  contain: content;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* CSS fx-рамки / gradient-text рисуют за пределами карточки — paint не клипать.
   contain:layout + backdrop-filter в TG WebView даёт тёмный прямоугольный flash
   на ~1с при открытии инвентаря/магазина. Без translateZ(0): иначе compositing
   layer клипает glow. */
.inventory-strip-card,
.shop-item-card,
.shop-cosmetic-card {
  contain: none;
  transform: none;
  backface-visibility: visible;
  overflow: visible;
}

.shop-item-card.shop-item-card--name-color,
.shop-item-card.shop-item-card--name-font,
.inventory-strip-card.shop-item-card--name-color,
.inventory-strip-card.shop-item-card--name-font {
  contain: none;
  transform: none;
  backface-visibility: visible;
}

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

.shop-fitting-panel,
.shop-fitting-strip {
  /* Без size: иначе height:auto схлопывается → оверлей и мёртвые клики.
     paint не клипаем — иначе обрывается бордер/ореол карточек. */
  contain: layout style;
}

/* 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;
}

.premium-wordmark-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 2px;
  line-height: 1;
}

.premium-wordmark {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffb3c0, #ff4d6d, #ffe0e6, #ff4d6d, #ffb3c0);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: premium-wordmark-shine 4.8s ease infinite;
  filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.42));
}

.premium-wordmark--common {
  background: linear-gradient(90deg, #b8fbff, #5cf0ff, #e7feff, #5cf0ff, #b8fbff);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(92, 240, 255, 0.42));
}

.premium-wordmark--rare {
  background: linear-gradient(90deg, #d4c6ff, #8b6cff, #efeaff, #8b6cff, #d4c6ff);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(139, 108, 255, 0.42));
}

.premium-wordmark--unique {
  background: linear-gradient(90deg, #ffb3c0, #ff4d6d, #ffe0e6, #ff4d6d, #ffb3c0);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 77, 109, 0.42));
}

.premium-p-badge {
  display: none !important;
}

@keyframes premium-wordmark-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Ник Premium: перелив без «убегания» текста (туда-обратно) */
@keyframes premium-nick-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.username-gradient-animated.username-premium-shine {
  background-size: 200% 100% !important;
  background-repeat: no-repeat !important;
  animation: premium-nick-shine 4.8s ease-in-out infinite !important;
  -webkit-animation: premium-nick-shine 4.8s ease-in-out infinite !important;
}

@media (prefers-reduced-motion: reduce) {
  .premium-wordmark,
  .username-gradient-animated.username-premium-shine,
  .avatar-frame-wrap > .fx-ring-core--soft-line { animation: none; }
}

/* ===== Clan Hub — Dark Liquid Glass (TMA: blur ≤16px, no contain+blur, safe areas) ===== */
body.clans-route .content-shell {
  gap: 0;
  margin-top: 0;
  padding-bottom: 0;
  width: 100%;
  max-width: none;
}

.ch-page {
  gap: 16px;
  min-width: 0;
  box-sizing: border-box;
  padding-top: calc(12px + var(--tg-app-inset-top, 52px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--dl-nav-offset) + var(--tg-app-inset-bottom, env(safe-area-inset-bottom, 20px)));
}

html.tg-webapp .ch-page {
  padding-top: max(
    calc(10px + var(--tg-app-inset-top, 52px)),
    calc(10px + env(safe-area-inset-top, 0px))
  );
}

.ch-page > .dl-aurora,
.ch-page > .pf-aurora {
  position: fixed;
}

a.shop-subview-back {
  text-decoration: none;
}

.ch-page .shop-subview-head__row {
  position: relative;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
}

.ch-page .shop-hub-hero__subtitle,
.ch-page .shop-subview-head__title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-page .shop-subview-head {
  margin-bottom: 0;
}

.ch-home {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.ch-page.is-edge-swiping [data-clan-home],
.ch-page.is-edge-swiping .ch-aux.is-on,
#clans-hub.is-edge-swiping #ch-gate-form {
  transition: none;
}

.ch-page:not(.is-edge-swiping) [data-clan-home],
.ch-page:not(.is-edge-swiping) .ch-aux.is-on,
#clans-hub:not(.is-edge-swiping) #ch-gate-form.is-on {
  transition: transform 0.22s var(--dl-ease-spring);
}

.ch-clan-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  pointer-events: none;
}

.ch-clan-head .shop-subview-back,
.ch-clan-head .ch-menu,
.ch-clan-head .ch-head-actions {
  pointer-events: auto;
}

.ch-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
  z-index: 6;
}

.ch-gift-btn {
  color: var(--dl-text-secondary);
}

.ch-gift-btn .pf-ico {
  width: 18px;
  height: 18px;
}

.ch-menu {
  position: relative;
  justify-self: end;
  z-index: 6;
}

.ch-menu__btn {
  position: relative;
  z-index: 51;
  pointer-events: auto;
  color: var(--dl-text-secondary);
}

.ch-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: default;
}

.ch-menu__drop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  border-radius: 16px;
  background: rgba(20, 24, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  pointer-events: none;
}

.ch-menu.is-on .ch-menu__drop {
  display: flex;
  pointer-events: auto;
  animation: ch-menu-in 0.18s var(--dl-ease-spring) both;
}

.ch-menu__drop[hidden],
.ch-menu__backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

@keyframes ch-menu-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.ch-menu__item {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-menu__item .pf-ico,
.ch-menu__item .ch-plane {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ch-menu__item:active {
  background: rgba(255, 255, 255, 0.08);
}

.ch-menu__item--danger {
  color: #fca5a5;
}

.ch-menu__item--danger:active {
  background: rgba(248, 113, 113, 0.12);
}

.ch-pill {
  appearance: none;
  -webkit-appearance: none;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--dl-glass-border);
  background: var(--dl-glass-bg);
  box-shadow: var(--dl-glass-inset-soft);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  color: var(--dl-text-secondary);
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-pill .pf-ico,
.ch-pill .ch-ico,
.ch-pill .ch-plane {
  width: 15px;
  height: 15px;
  display: block;
}

.ch-plane {
  transform: translate(-1px, 1px);
}

.ch-pill:active { transform: scale(0.96); opacity: 0.9; }
.ch-view,
#ch-gate-form {
  display: none;
}

.ch-create-step {
  display: none;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ch-create-step.is-on {
  display: flex;
}

#ch-gate-form:not([data-create-step="1"]) #ch-create-colorline,
#ch-gate-form:not([data-create-step="1"]) #ch-create-frame-colorline {
  display: none;
}

.ch-create-lead {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--dl-text-secondary);
}

.ch-view.is-on,
#ch-gate-form.is-on {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  animation: ch-fade 0.22s var(--dl-ease-spring);
}

.ch-open {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 0 4px 4px;
  background: none;
  border: 0;
  box-shadow: none;
}

.ch-open .ch-emblem {
  width: 120px;
  height: 120px;
  margin: 0 auto 6px;
  border-radius: 32px;
  border: 2px solid var(--clan-color, #ff7a18);
  background: rgba(8, 10, 16, 0.55);
  box-shadow: none;
  filter: none;
  overflow: hidden;
}

.ch-set-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 2px 4px 10px;
}

.ch-set-stage .ch-emblem {
  width: 120px;
  height: 120px;
  margin: 0 auto 2px;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  filter: none;
  overflow: visible;
  isolation: isolate;
}

.ch-open .ch-emblem .ch-logo,
.ch-set-stage .ch-emblem .ch-logo {
  font-size: 0;
  width: 68%;
  height: 68%;
}

.ch-set-stage .ch-titleline {
  margin: 0;
}

.ch-set-colorline {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.ch-set-stage .ch-set-colorline + .ch-set-colorline {
  margin-top: 8px;
}

.ch-set-swatch {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 12px color-mix(in srgb, var(--clan-color, #3b82f6) 45%, transparent);
  flex-shrink: 0;
}

.ch-set-colorline .ch-btn {
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
  pointer-events: none;
}

.ch-color-open {
  position: relative;
  display: inline-flex;
  isolation: isolate;
  overflow: hidden;
  z-index: 0;
}

.ch-page input.ch-color-pick-overlay,
.ch-color-pick-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0.011;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ch-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ch-help {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--dl-text-secondary);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-help-pop {
  margin: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 10, 16, 0.72);
  color: var(--dl-text-secondary);
  font-size: 0.75rem;
  line-height: 1.35;
}

.ch-rename-hint {
  margin: 0 0 12px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--dl-text-muted);
}

.ch-type-hint {
  margin: 2px 2px 0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
}

.ch-type-hint--open { color: var(--dl-mint); }
.ch-type-hint--closed { color: var(--dl-coral-soft); }

.ch-rename-pay {
  width: 100%;
  min-height: 44px;
  margin-top: 0;
}

#ch-rename-sheet,
#ch-leave-sheet,
#ch-disband-sheet,
.ch-sheet--center {
  position: fixed;
  inset: 0;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top, 0px)) 16px max(12px, env(safe-area-inset-bottom, 0px));
  border: none;
  background: transparent;
  color: inherit;
  box-sizing: border-box;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  transform: none;
}

#ch-rename-sheet.is-on,
#ch-rename-sheet[open],
#ch-leave-sheet.is-on,
#ch-leave-sheet[open],
#ch-req-list-sheet.is-on,
#ch-req-list-sheet[open],
#ch-disband-sheet.is-on,
#ch-disband-sheet[open],
.ch-sheet--center.is-on,
.ch-sheet--center[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;
}

#ch-rename-sheet[hidden],
#ch-leave-sheet[hidden],
#ch-req-list-sheet[hidden],
#ch-disband-sheet[hidden],
.ch-sheet--center[hidden] {
  display: none !important;
}

#ch-rename-sheet::backdrop,
#ch-leave-sheet::backdrop,
#ch-req-list-sheet::backdrop,
#ch-disband-sheet::backdrop,
.ch-sheet--center::backdrop {
  background: rgba(8, 10, 16, 0.55);
}

#ch-rename-sheet .ch-sheet__backdrop,
#ch-leave-sheet .ch-sheet__backdrop,
#ch-req-list-sheet .ch-sheet__backdrop,
#ch-disband-sheet .ch-sheet__backdrop,
.ch-sheet--center .ch-sheet__backdrop {
  position: absolute;
  inset: 0;
}

#ch-rename-sheet .ch-sheet__panel,
#ch-leave-sheet .ch-sheet__panel,
#ch-req-list-sheet .ch-sheet__panel,
#ch-disband-sheet .ch-sheet__panel,
.ch-sheet--center .ch-sheet__panel {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  width: min(400px, calc(100vw - 32px));
  max-height: min(82dvh, 82vh, 640px);
  margin: 0;
  overflow: auto;
  transform: none;
  z-index: 1;
}

#btn-rename-name,
#btn-rename-tag,
#btn-disband {
  position: relative;
  z-index: 2;
}

.ch-color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ch-page input.ch-color-pick,
.ch-color-pick {
  width: 48px;
  min-width: 48px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}

.ch-color-pick::-webkit-color-swatch-wrapper { padding: 3px; }
.ch-color-pick::-webkit-color-swatch {
  border: 0;
  border-radius: 9px;
}

.ch-color-pick::-moz-color-swatch {
  border: 0;
  border-radius: 9px;
}

.ch-color-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.ch-logo {
  display: block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  background-color: var(--clan-color, #fff);
  background-image: var(--clan-logo-fill, none);
  background-size: 200% 200%;
  background-repeat: no-repeat;
  background-position: 0% 50%;
  -webkit-mask: var(--ch-logo) center / contain no-repeat;
  mask: var(--ch-logo) center / contain no-repeat;
}

.ch-emblem .ch-logo {
  font-size: 3.6rem;
  width: 1em;
  height: 1em;
}

.ch-emblem--sm .ch-logo {
  font-size: 2rem;
}

.ch-pick .ch-logo {
  font-size: 1.7rem;
  background-color: #fff;
}

.ch-emblem {
  width: 112px;
  height: 112px;
  margin: 0 auto 4px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  font-size: 2.15rem;
  line-height: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--clan-color, #5cf0ff);
  box-shadow:
    0 0 16px color-mix(in srgb, var(--clan-color, #5cf0ff) 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.ch-emblem--sm {
  width: 58px;
  height: 58px;
  margin: 0;
  border-radius: 16px;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 0 14px var(--clan-color, #5cf0ff);
}

/* ===== Clan badge shapes ===== */
.clan-badge-shape {
  --clan-accent-glow: color-mix(in srgb, var(--clan-color, #ffd166) 68%, #ffe08a 32%);
  --badge-clip: none;
  --badge-mask: none;
  --badge-radius: 0px;
  --badge-plate: rgba(8, 10, 16, 0.55);
  --badge-svg-d: path("M27 0H73A27 27 0 0 1 100 27V73A27 27 0 0 1 73 100H27A27 27 0 0 1 0 73V27A27 27 0 0 1 27 0Z");
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: none;
}

.clan-badge-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  filter: none;
  background: transparent;
  border: 0;
}

.clan-badge-frame::before,
.clan-badge-frame::after {
  content: none;
}

.clan-badge-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.clan-badge-plate {
  fill: var(--badge-plate);
  d: var(--badge-svg-d);
}

.clan-badge-stroke {
  fill: none;
  stroke: var(--clan-frame-color, var(--clan-color, #ffd166));
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  d: var(--badge-svg-d);
}

.clan-badge-shape.clan-logo--animated .ch-logo {
  animation: gradient-flow 5s ease infinite;
  -webkit-animation: gradient-flow 5s ease infinite;
}

.clan-badge-shape.clan-badge--glow {
  --clan-accent-glow: color-mix(in srgb, var(--clan-frame-color, var(--clan-color, #ffd166)) 72%, #ffe08a 28%);
  filter: drop-shadow(0 0 12px var(--clan-accent-glow));
}

.clan-badge-shape.shape-none .clan-badge-svg,
.clan-badge-shape.shape-none .clan-badge-frame {
  display: none;
}

.clan-badge-shape.shape-none {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.clan-badge-shape.shape-none .clan-badge-img .ch-logo {
  width: 86%;
  height: 86%;
  max-width: 86%;
  max-height: 86%;
}

.ch-shapepick .clan-badge-shape.shape-none::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.clan-badge-img {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  clip-path: none !important;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}

.clan-badge-img .ch-logo {
  width: 68%;
  height: 68%;
  max-width: 68%;
  max-height: 68%;
  object-fit: contain;
  pointer-events: none;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.clan-badge-shape.shape-none { --badge-clip: none; --badge-svg-d: none; }
.clan-badge-shape.shape-squircle {
  --badge-clip: none;
  --badge-radius: 32px;
  --badge-svg-d: path("M27 0H73A27 27 0 0 1 100 27V73A27 27 0 0 1 73 100H27A27 27 0 0 1 0 73V27A27 27 0 0 1 27 0Z");
}
.clan-badge-shape.shape-gothic-shield {
  --badge-svg-d: path("M0 0H100V70L50 100L0 70Z");
}
.clan-badge-shape.shape-heater-plate {
  --badge-svg-d: path("M11.51 1.10 1.10 10.70 1.10 37.85 4.79 39.08 7.82 41.32 9.77 44.39 10.42 46.84 10.42 51.74 9.77 55.00 8.04 59.90 5.44 64.80 3.92 70.32 3.92 73.79 5.00 77.87 7.39 81.95 13.24 87.26 18.88 90.53 26.25 93.59 39.48 97.27 48.59 98.90 51.41 98.90 60.52 97.27 70.71 94.61 77.00 92.37 83.07 89.51 87.62 86.65 91.74 82.97 94.13 79.71 95.86 75.22 96.08 70.32 94.56 64.80 91.96 59.90 90.23 55.00 89.58 51.74 89.58 46.84 90.23 44.39 92.18 41.32 95.21 39.08 98.90 37.85 98.90 10.70 88.49 1.10 11.73 1.10Z");
}
.clan-badge-shape.shape-tactical-hex {
  --badge-svg-d: path("M50 0L100 22V78L50 100L0 78V22Z");
}
.clan-badge-shape.shape-cyber-chamfer {
  --badge-svg-d: path("M18 0H82L100 18V82L82 100H18L0 82V18Z");
}
.clan-badge-shape.shape-wide-bastion {
  --badge-svg-d: path("M0 0H100V82L80 100H20L0 82Z");
}
.clan-badge-shape.shape-banner-flag {
  --badge-svg-d: path("M0 0H100V100L50 84L0 100Z");
}
.clan-badge-shape.shape-iron-wedge {
  --badge-svg-d: path("M5 0H95L85 100H15Z");
}
.clan-badge-shape.shape-tech-shield {
  --badge-svg-d: path("M15 0H85L100 20L85 85L50 100L15 85L0 20Z");
}
.clan-badge-shape.shape-crest-shield {
  --badge-svg-d: path("M39.44 1.10 27.14 2.34 17.71 4.39 9.71 7.69 6.02 10.37 3.77 13.04 2.13 17.16 2.33 22.72 3.56 26.43 9.30 37.96 10.53 42.07 10.94 45.99 10.12 49.49 8.28 51.75 5.41 53.19 3.15 53.60 1.10 53.40 16.07 79.55 20.37 85.31 23.65 88.61 26.93 91.08 32.26 93.96 39.65 96.64 49.08 98.90 50.92 98.90 60.35 96.64 67.74 93.96 75.12 89.63 79.63 85.31 85.16 77.49 98.90 53.40 96.85 53.60 94.59 53.19 91.72 51.75 89.88 49.49 89.06 45.99 89.47 42.07 92.34 34.04 96.44 26.43 97.87 21.69 97.87 17.16 96.23 13.04 92.75 9.34 87.83 6.45 82.29 4.39 75.32 2.75 63.84 1.31 39.65 1.10Z");
}
.clan-badge-shape.shape-saw-edge {
  --badge-svg-d: path("M1.10 1.10 10.20 10.20 2.00 18.23 10.15 26.42 2.00 34.26 10.15 42.44 2.05 50.48 10.15 58.47 2.05 66.51 10.15 74.55 2.00 82.39 10.15 90.57 1.60 98.90 98.40 98.90 89.85 90.24 98.00 82.25 89.85 74.21 98.00 66.22 89.85 58.18 98.00 50.14 89.85 42.11 98.00 34.12 89.85 26.08 98.00 18.09 89.85 10.05 98.90 1.10Z");
}
.clan-badge-shape.shape-horn-peak {
  --badge-svg-d: path("M1.10 1.10 10.53 4.80 18.73 7.53 28.57 10.06 35.14 11.04 41.70 11.04 44.98 10.45 48.67 8.50 50.00 6.75 51.13 8.31 52.36 9.28 54.41 10.26 56.87 10.84 64.66 11.04 67.94 10.65 73.27 9.67 80.65 7.72 90.49 4.41 98.90 1.10 96.44 9.28 91.93 27.60 89.88 38.51 88.65 47.47 88.03 55.65 88.24 65.78 88.85 70.07 89.88 73.96 91.52 78.25 78.19 82.92 66.51 88.38 54.20 95.78 50.00 98.90 45.80 95.78 38.42 91.11 31.24 87.21 21.81 82.92 13.61 79.81 8.48 78.25 10.12 73.96 11.15 70.07 11.76 65.78 11.97 55.65 11.35 47.47 10.12 38.51 7.66 25.65 3.36 8.50Z");
}
.clan-badge-shape.shape-order-badge {
  --badge-svg-d: path("M23.70 1.10 22.30 4.29 21.30 5.69 19.10 7.89 16.70 9.48 14.30 10.48 10.50 11.28 3.70 11.08 6.50 12.68 8.90 15.07 10.70 17.67 12.10 20.46 13.10 23.25 14.10 28.04 14.30 37.23 13.10 45.41 10.90 53.79 6.90 64.57 4.70 69.56 1.10 76.55 1.10 77.34 2.90 79.74 6.50 82.93 10.10 85.33 13.90 87.32 19.30 89.52 27.70 91.91 36.70 93.51 44.70 94.11 47.50 97.50 49.70 98.90 50.30 98.90 52.50 97.50 55.30 94.11 63.30 93.51 72.30 91.91 78.30 90.32 84.30 88.12 88.10 86.33 92.70 83.53 95.90 80.94 98.90 77.34 98.90 76.55 95.30 69.56 93.10 64.57 89.30 54.39 86.90 45.41 85.70 37.23 85.90 28.04 86.90 23.25 87.90 20.46 89.30 17.67 91.10 15.07 93.50 12.68 96.30 11.08 89.50 11.28 87.10 10.88 84.10 9.88 80.90 7.89 78.70 5.69 77.70 4.29 76.30 1.10 71.10 3.30 64.90 5.29 58.30 6.69 52.50 7.29 44.90 7.09 37.50 5.89 31.10 4.09 23.90 1.10Z");
}
.clan-badge-shape.shape-swallow-tail {
  --badge-svg-d: path("M1.10 1.10 1.10 98.90 15.92 84.68 29.95 98.51 70.05 98.51 84.28 84.68 98.90 98.90 98.90 1.10Z");
}
.clan-badge-shape.shape-arch-plate {
  --badge-svg-d: path("M1.10 1.10 1.10 78.86 50 98.90 98.90 78.86 98.90 1.10 81.32 1.10A31.32 9.13 0 0 1 18.68 1.10Z");
}

.ch-open .ch-emblem.clan-badge-shape,
.ch-set-stage .ch-emblem.clan-badge-shape {
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
}

.ch-open .ch-emblem.clan-badge-shape .ch-logo,
.ch-set-stage .ch-emblem.clan-badge-shape .ch-logo,
.ch-rowcard--clan .ch-emblem--sm.clan-badge-shape .ch-logo {
  width: 68%;
  height: 68%;
  max-width: 68%;
  max-height: 68%;
}

.ch-emblem--sm.clan-badge-shape,
.ch-rowcard--clan .ch-emblem--sm.clan-badge-shape {
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.ch-emblem--sm.clan-badge-shape.shape-squircle { --badge-radius: 16px; }
.ch-rowcard--clan .ch-emblem--sm.clan-badge-shape.shape-squircle { --badge-radius: 18px; }
.ch-emblem--sm .clan-badge-frame { filter: none; }

.ch-shapepicks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ch-shapepick {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 6px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.ch-shapepick .clan-badge-shape {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  filter: none;
}

.ch-shapepick .clan-badge-frame { filter: none; }

.ch-shapepick.is-active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.ch-titleline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  margin: 0;
  min-width: 0;
  text-align: center;
}

.ch-titleline .ch-name {
  font-size: clamp(1.35rem, 5.6vw, 1.85rem);
}

.ch-titleline .ch-tag {
  flex-shrink: 0;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
}

.ch-name {
  margin: 0;
  max-width: 100%;
  font-family: Unbounded, system-ui, sans-serif;
  font-size: clamp(1.2rem, 5.2vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-name.username-font,
.ch-titleline .ch-name.username-font,
.inventory-stage__name .ch-name.username-font,
#ch-set-preview-name.username-font {
  font-family: var(--uf-family, Unbounded), Unbounded, sans-serif !important;
  font-weight: var(--uf-weight, 700);
  letter-spacing: var(--uf-tracking, 0);
}

.ch-tag[style] {
  color: inherit;
}

.ch-tag {
  margin: 0;
  font-family: Unbounded, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--dl-text-secondary);
}

.ch-tag.username-font,
.ch-titleline .ch-tag.username-font,
.inventory-stage__name .ch-tag.username-font,
#ch-set-preview-tag.username-font {
  font-family: Unbounded, system-ui, sans-serif !important;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.ch-role {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 4px;
  padding: 0 10px;
  border-radius: var(--dl-radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ch-role--leader { color: var(--dl-gold); border-color: var(--dl-tint-gold-border); background: var(--dl-tint-gold-bg); }
.ch-role--deputy { color: var(--dl-violet-soft); border-color: var(--dl-tint-violet-border); background: var(--dl-tint-violet-bg); }
.ch-role--officer { color: var(--dl-cyan); border-color: var(--dl-tint-cyan-border); background: var(--dl-tint-cyan-bg-soft); }
.ch-role--member { color: var(--dl-text-secondary); }
.ch-open .ch-you { margin: 0; }

.ch-desc {
  margin: 4px 0 0;
  max-width: min(100%, 34ch);
  font-size: 0.78rem;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ch-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ch-cta,
.ch-sheet__panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.ch-stat {
  min-width: 0;
  padding: 14px 8px 12px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.ch-about {
  width: min(100%, 280px);
}

.ch-about__btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.ch-about__btn::-webkit-details-marker { display: none; }

.ch-about__text {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
}

.ch-stat--plain {
  padding: 0;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  gap: 6px;
}

.ch-stat--plain .pf-ico { width: 18px; height: 18px; }

html.tg-webapp .ch-stat--plain {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.ch-stat strong,
.ch-stat__val {
  max-width: 100%;
  font-size: clamp(0.82rem, 3.4vw, 1rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-stat span,
.ch-kicker {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dl-text-muted);
}

.ch-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
}

.ch-kicker--center { justify-content: center; letter-spacing: 0.16em; text-transform: uppercase; }
.ch-kicker .pf-ico { width: 14px; height: 14px; }

.ch-infocard {
  display: grid;
  grid-template-columns: minmax(108px, 0.9fr) 1px minmax(0, 1.2fr);
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border-radius: 18px;
  min-width: 0;
}

.ch-infocard__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.ch-infocard__stats li {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ch-infocard__stats .pf-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.ch-infocard__stats span {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
}

.ch-infocard__stats strong {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ch-infocard__rule {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.12);
}

.ch-infocard__desc {
  margin: 0;
  min-width: 0;
  max-height: 96px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
}

.ch-glance {
  display: grid;
  grid-template-columns: auto 1px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  min-width: 0;
}

.ch-glance__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.ch-glance__stats li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ch-glance__ico {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ch-glance__ico .pf-ico { width: 16px; height: 16px; }

.ch-glance__stats strong {
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.ch-glance__rule {
  width: 1px;
  height: 72%;
  justify-self: center;
  background: rgba(255, 255, 255, 0.12);
}

.ch-glance__desc {
  margin: 0;
  min-width: 0;
  max-height: 5.2em;
  padding: 0 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.82);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ch-glance__desc.is-empty {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.ch-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 4px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.ch-seg--2 {
  grid-template-columns: repeat(2, 1fr);
}

.ch-tagpicks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ch-tagpick {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-tagpick.is-active {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
}

.ch-page input.ch-income-inline {
  width: auto;
  min-width: 108px;
  max-width: 42%;
  flex: 1 1 108px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
}

.ch-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ch-home > .ch-marks {
  justify-content: center;
}

.ch-rowcard__body .ch-marks {
  margin-top: 8px;
}

.ch-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
}

.ch-mark--open {
  border-color: var(--dl-mint);
  background: var(--dl-tint-mint-bg);
  box-shadow: 0 0 10px rgba(47, 255, 193, 0.28);
}

.ch-mark--closed {
  border-color: var(--dl-coral);
  background: var(--dl-tint-coral-bg);
  box-shadow: 0 0 10px rgba(255, 77, 109, 0.28);
}

.ch-mark--label {
  border-color: var(--dl-violet);
  background: var(--dl-tint-violet-bg);
  box-shadow: 0 0 10px rgba(139, 108, 255, 0.3);
}

.ch-seg__btn {
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #fff;
  opacity: 0.6;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-seg__btn span {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.ch-seg__btn .pf-ico,
.ch-seg__btn .ch-ico { width: 14px; height: 14px; flex-shrink: 0; }

.ch-seg__btn.is-on {
  opacity: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 16px rgba(92, 240, 255, 0.28);
}

.ch-seg__badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fb7185;
  color: #1a1020;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.ch-stage {
  position: relative;
  min-width: 0;
  transition: min-height 0.22s ease;
}

.ch-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ch-panel.is-on {
  display: flex;
  gap: 14px;
  animation: ch-in 0.24s var(--dl-ease-spring) both;
}

.ch-panel[hidden] { display: none !important; }

.ch-home.is-off { display: none; }

.ch-aux {
  display: none;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ch-aux.is-on {
  display: flex;
  animation: ch-in 0.24s var(--dl-ease-spring) both;
}

.ch-aux .ch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ch-aux .ch-btn .pf-ico { width: 16px; height: 16px; }

.ch-invite {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ch-invite input { flex: 1; min-width: 0; }

.ch-invite__btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--dl-tint-cyan-border);
  background: var(--dl-tint-cyan-bg);
  color: var(--dl-cyan);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-invite__btn .pf-ico { width: 18px; height: 18px; }

.ch-member {
  position: relative;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 16px;
  overflow: hidden;
}

.ch-member .ch-role,
.ch-member .ch-role--leader,
.ch-member .ch-role--deputy,
.ch-member .ch-role--officer,
.ch-member .ch-role--member {
  margin-top: 1px;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.55);
}

.ch-member__mid {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  overflow: hidden;
  padding-top: 1px;
}

.ch-member__end {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-width: 0;
  padding-top: 1px;
}

.ch-member__role--leader { color: var(--dl-gold); }
.ch-member__role--deputy { color: var(--dl-violet-soft); }
.ch-member__role--officer { color: var(--dl-cyan); }

.ch-member__more {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-member__more .ch-vdots {
  width: 16px;
  height: 18px;
  display: block;
}

.ch-member-pop {
  position: fixed;
  z-index: 60;
  width: 188px;
  margin: 0;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 14px;
  background: rgba(20, 24, 33, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.ch-member-pop[hidden] { display: none; }

.ch-member-pop__item {
  appearance: none;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-member-pop__item:active { background: rgba(255, 255, 255, 0.08); }
.ch-member-pop__item--danger { color: var(--dl-coral-soft); }
.ch-member__more:active { color: #fff; transform: scale(0.96); }

.ch-you {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #3dff9a;
}

.ch-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin: 0;
}

.ch-nick {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.ch-present {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}

.ch-income {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--dl-mint);
  white-space: nowrap;
}

.ch-income svg { width: 14px; height: 14px; flex-shrink: 0; }

.ch-ava {
  position: relative;
  width: 46px;
  height: 46px;
  margin: 0;
  flex-shrink: 0;
}

.ch-ava__img,
.ch-ava__fallback {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  display: grid;
  place-items: center;
  position: absolute;
  left: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.ch-ava__frame,
.ch-ava__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}

.ch-ava__ring {
  border-radius: 16px;
  padding: 2px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.ch-gate-home,
.ch-gate-form { display: none; }
.ch-gate-home.is-on,
.ch-gate-form.is-on {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: ch-fade 0.22s var(--dl-ease-spring);
}

@keyframes ch-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.ch-card {
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}

.ch-card.ch-member {
  padding: 8px 10px;
  border-radius: 16px;
}

.ch-stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#members-list.card-grid-compact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-page .ch-member-card.character-card-mini {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  height: auto;
  padding: 10px 12px;
  text-align: left;
  border-radius: var(--dl-radius-md);
  overflow: visible;
  contain: none;
  transform: none;
  cursor: pointer;
}

.ch-page .ch-member-card .card-avatar-large {
  width: auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.ch-page .ch-member-card .avatar-frame-wrap {
  overflow: visible;
  flex-shrink: 0;
}

.ch-page .ch-member-card .avatar-frame-avatar,
.ch-page .ch-member-card .pf-slave-photo .ch-ava__fallback,
.ch-page .ch-member-card .ch-ava__fallback {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 11px;
  font-size: 1.25rem;
  z-index: 2;
}

.ch-page .ch-member-card .card-info-vertical,
.ch-page .ch-member-card .card-name-line {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}

.ch-page .ch-member-card .card-info-vertical {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}

.ch-page .ch-member-card .card-name-line {
  width: fit-content;
  max-width: 100%;
  gap: 3px;
}

.ch-page .ch-member-card .card-name-line .card-name,
.ch-page .ch-member-card .card-name {
  width: auto;
  max-width: 100%;
  font-size: 1.08rem;
  font-weight: 700;
  text-align: left;
}

.ch-page .ch-member-card .card-name.username-gradient-animated {
  background-size: 200% 200% !important;
  background-repeat: no-repeat !important;
  background-position: 0% 50%;
  animation: gradient-flow 5s ease infinite !important;
  -webkit-animation: gradient-flow 5s ease infinite !important;
  transform: translateZ(0);
}

.ch-page .ch-member-card .card-name-line .username-present-status-wrap {
  margin-left: 0;
}

.ch-page .ch-member-card .card-job,
.ch-page .ch-member-card .ch-role,
.ch-page .ch-member-card .ch-role--leader,
.ch-page .ch-member-card .ch-role--deputy,
.ch-page .ch-member-card .ch-role--officer,
.ch-page .ch-member-card .ch-role--member {
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  text-align: left;
  color: var(--rarity-border-common, #5cf0ff);
}

.ch-page .ch-member-card .ch-role--leader,
#ch-member-modal .ch-role--leader { color: var(--rarity-border-limited, #ffd166); }
.ch-page .ch-member-card .ch-role--deputy,
#ch-member-modal .ch-role--deputy { color: var(--rarity-border-unique, #ff4d6d); }
.ch-page .ch-member-card .ch-role--officer,
#ch-member-modal .ch-role--officer { color: var(--rarity-border-rare, #8b6cff); }
.ch-page .ch-member-card .ch-role--member,
#ch-member-modal .ch-role--member { color: var(--rarity-border-common, #5cf0ff); }

.ch-page .ch-member-card.ch-member-card--leader,
html.tg-webapp .ch-page .ch-member-card.character-card-mini.ch-member-card--leader {
  border: 1px solid rgba(255, 209, 102, 0.42) !important;
  box-shadow: 0 0 14px var(--rarity-glow-limited, rgba(255, 209, 102, 0.4)) !important;
}

.ch-page .ch-member-card.ch-member-card--deputy,
html.tg-webapp .ch-page .ch-member-card.character-card-mini.ch-member-card--deputy {
  border: 1px solid rgba(255, 77, 109, 0.42) !important;
  box-shadow: 0 0 12px var(--rarity-glow-unique, rgba(255, 77, 109, 0.36)) !important;
}

.ch-page .ch-member-card.ch-member-card--officer,
html.tg-webapp .ch-page .ch-member-card.character-card-mini.ch-member-card--officer {
  border: 1px solid rgba(139, 108, 255, 0.42) !important;
  box-shadow: 0 0 10px var(--rarity-glow-rare, rgba(139, 108, 255, 0.34)) !important;
}

.ch-page .ch-member-card.ch-member-card--member,
html.tg-webapp .ch-page .ch-member-card.character-card-mini.ch-member-card--member {
  border: 1px solid rgba(92, 240, 255, 0.42) !important;
  box-shadow: 0 0 10px var(--rarity-glow-common, rgba(92, 240, 255, 0.32)) !important;
}

.ch-page .ch-member-income {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: auto;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--dl-mint) !important;
  font-weight: 700;
  text-align: right;
}

#join-requests {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

#join-requests[hidden] {
  display: none !important;
}

.ch-req-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 209, 102, 0.34);
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.16);
}

.ch-req-entry__faces {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 6px;
}

.ch-req-entry__ava,
.ch-req-entry__more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(12, 14, 22, 0.92);
  margin-left: -10px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.ch-req-entry__faces > :first-child {
  margin-left: 0;
}

.ch-req-entry__ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.ch-req-entry__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--dl-text-muted);
}

.ch-req-entry__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ch-req-entry__body strong {
  font-size: 1rem;
}

.ch-req-entry__body span {
  font-size: 0.78rem;
  color: var(--dl-text-muted);
}

.ch-req-entry__count {
  flex-shrink: 0;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 209, 102, 0.18);
  color: #ffd166;
  font-size: 0.82rem;
  font-weight: 800;
}

#ch-req-list-sheet .ch-req-inbox-panel {
  width: min(420px, calc(100vw - 24px));
  max-height: min(88dvh, 88vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 12px 12px;
}

.ch-req-inbox__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  flex-shrink: 0;
}

.ch-req-inbox__head .ch-sheet__title {
  margin: 0;
}

.ch-req-inbox__n {
  margin-left: 6px;
  color: #ffd166;
  font-weight: 800;
}

.ch-req-inbox__x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ch-req-inbox__x .pf-ico {
  width: 16px;
  height: 16px;
}

#ch-req-inbox.ch-req-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.ch-req-list.card-grid-compact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-req-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  transition: transform 0.24s ease, opacity 0.24s ease, margin 0.24s ease;
}

.ch-req-item.is-out {
  transform: translateX(36px);
  opacity: 0;
  pointer-events: none;
}

.ch-page .ch-req-card.character-card-mini,
html.tg-webapp .ch-page .ch-req-card.character-card-mini {
  border: 1px solid rgba(255, 209, 102, 0.34) !important;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.2) !important;
}

.ch-page .ch-req-card .ch-req-age,
.ch-page .ch-req-age {
  color: var(--dl-text-muted) !important;
}

.ch-req__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ch-req__actions .ch-btn {
  width: 100%;
}

.ch-req-who {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-req-confirm {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 16px;
  border-radius: inherit;
  background: rgba(8, 10, 16, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ch-req-confirm[hidden] {
  display: none !important;
}

#ch-member-modal .modal-content {
  text-align: left;
  position: relative;
}

#ch-member-modal header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding-right: 40px;
}

#ch-member-modal-ava {
  flex-shrink: 0;
}

#ch-member-modal .char-info {
  flex: 1;
  min-width: 0;
}

#ch-member-modal .char-info h3 {
  font-size: 1.08rem;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ch-member-modal .char-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.58);
}

#ch-member-modal .char-stats .accent { color: var(--dl-mint); }
#ch-member-modal .char-stats-sep { opacity: 0.5; }
#ch-member-modal .ch-role { font-weight: 400; }

#ch-member-modal .modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

#ch-member-modal .modal-actions[hidden] {
  display: none !important;
  margin: 0;
}

#ch-member-modal .modal-actions .btn {
  font-size: 0.78rem;
  padding: 11px 10px;
}

#ch-member-modal .close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  line-height: 0;
}

#ch-member-modal .close .pf-ico {
  display: block;
  width: 14px;
  height: 14px;
}

.ch-page .ch-member-income .pf-ico {
  width: 12px;
  height: 12px;
}

.ch-page .ch-member-income__rate {
  color: #fff;
  font-weight: 600;
}

.ch-rowcard {
  display: flex;
  align-items: center;
  gap: 12px;
}

a.ch-rowcard--clan {
  text-decoration: none;
  color: inherit;
  align-items: center;
  min-height: 0;
  padding: 10px 12px;
  gap: 10px;
  box-sizing: border-box;
}

.ch-rowcard--clan .ch-emblem--sm {
  width: 64px;
  height: 68px;
  border-radius: 18px;
  flex-shrink: 0;
  background: rgba(8, 10, 16, 0.55);
  box-shadow: none;
  filter: none;
  overflow: hidden;
}

.ch-rowcard--clan .ch-emblem--sm.clan-badge-shape .clan-badge-frame,
.ch-rowcard--clan .ch-emblem--sm.clan-badge-shape .clan-badge-img {
  bottom: 4px;
}

.ch-rowcard--clan .ch-emblem--sm .ch-logo {
  font-size: 0;
  width: 68%;
  height: 68%;
}

.ch-rowcard--clan .ch-dir-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.ch-dir-name .ch-dir-name__text.username-font,
.ch-dir-name .ch-dir-tag.username-font {
  font-family: var(--uf-family, Unbounded), Unbounded, sans-serif !important;
  font-weight: var(--uf-weight, 700);
  letter-spacing: var(--uf-tracking, 0);
}

.ch-dir-name .ch-dir-tag {
  font-size: 0.42em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dl-text-secondary);
}

.ch-dir-name .ch-dir-tag[style],
.ch-dir-name .ch-dir-tag.username-font {
  color: inherit;
}

.ch-rowcard--clan .ch-marks {
  margin-top: 4px;
  gap: 4px;
}

.ch-rowcard--clan .ch-mark {
  min-height: 16px;
  padding: 0 7px;
  font-size: 8px;
  font-weight: 700;
  box-shadow: 0 0 6px rgba(139, 108, 255, 0.22);
}

.ch-rowcard--clan .ch-mark--open {
  box-shadow: 0 0 6px rgba(47, 255, 193, 0.2);
}

.ch-rowcard--clan .ch-mark--closed {
  box-shadow: 0 0 6px rgba(255, 77, 109, 0.2);
}

.ch-dir-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 1px;
}

.ch-dir-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.ch-dir-stat .pf-ico {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.ch-rowcard__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ch-rowcard__body > span,
.ch-meta {
  font-size: 0.75rem;
  color: var(--dl-text-muted);
}

.ch-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.ch-bar {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ch-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dl-cyan), var(--dl-violet));
}

.ch-bar > span.is-done { background: var(--dl-mint); }

.ch-vault__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ch-vault__head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.ch-vault__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ch-vault > .ch-help-pop {
  margin: 0 2px 4px;
}

.ch-vault__balance {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
}

.ch-vault__main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ch-vault__figures {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ch-vault__gem {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--dl-gold);
}

.ch-vault__gem::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 209, 102, 0.5) 0%, rgba(255, 209, 102, 0.18) 42%, transparent 70%);
  pointer-events: none;
}

.ch-vault__gem .pf-ico {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
}

.ch-vault__label {
  position: relative;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dl-text-muted);
}

.ch-vault__sum {
  position: relative;
  margin: 0;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--dl-gold);
}

.ch-vault__unit {
  margin: 0;
  font-size: 0.78rem;
  color: var(--dl-text-muted);
}

.ch-vault__sum.is-bump { animation: ch-vault-bump 0.38s var(--dl-ease-spring); }

@keyframes ch-vault-bump {
  40% { transform: scale(1.045); }
}

.ch-vault__mine {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--dl-text-secondary);
}

.ch-vault__mine strong {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: var(--dl-gold);
}

.ch-goals {
  gap: 14px;
}

.ch-goal-bank {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
}

.ch-goal-bank::before {
  content: "";
  position: absolute;
  inset: auto -20% 40% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.16) 0%, transparent 68%);
  pointer-events: none;
}

.ch-goal-bank__main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.ch-goal-bank__figures {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ch-goal-bank__orb {
  position: relative;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--dl-gold);
}

.ch-goal-bank__orb::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 209, 102, 0.5) 0%, rgba(255, 209, 102, 0.16) 42%, transparent 70%);
  pointer-events: none;
}

.ch-goal-bank__orb .ch-ico {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
}

.ch-goal-bank__label {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dl-text-muted);
}

.ch-goal-bank__sum {
  margin: 0;
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--dl-gold);
}

.ch-goal-bank__sum.is-bump { animation: ch-vault-bump 0.38s var(--dl-ease-spring); }

.ch-goal-bank__unit {
  margin: 0;
  font-size: 0.78rem;
  color: var(--dl-text-muted);
}

.ch-goal-bank__week {
  position: relative;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--dl-text-secondary);
}

.ch-goal-bank__week time {
  font-variant-numeric: tabular-nums;
  color: var(--dl-gold);
  font-weight: 700;
}

.ch-goal-shelf {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-goal-kicker {
  margin: 0 4px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 209, 102, 0.78);
}

.ch-goal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-goal-card {
  --goal: var(--dl-cyan);
  --goal-soft: var(--dl-tint-cyan-bg);
  --goal-glow: rgba(92, 240, 255, 0.32);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
}

.ch-goal-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 999px;
  background: var(--goal);
  box-shadow: 0 0 12px var(--goal-glow);
  opacity: 0.85;
}

.ch-goal--upgrade { --goal: #ff8b6a; --goal-soft: rgba(255, 139, 106, 0.14); --goal-glow: rgba(255, 139, 106, 0.38); }
.ch-goal--growth { --goal: var(--dl-mint); --goal-soft: var(--dl-tint-mint-bg); --goal-glow: rgba(47, 255, 193, 0.36); }
.ch-goal--chain { --goal: var(--dl-violet-soft); --goal-soft: var(--dl-tint-violet-bg); --goal-glow: rgba(198, 168, 255, 0.38); }
.ch-goal--buy { --goal: var(--dl-cyan); --goal-soft: var(--dl-tint-cyan-bg); --goal-glow: rgba(92, 240, 255, 0.36); }
.ch-goal--collect { --goal: var(--dl-gold); --goal-soft: var(--dl-tint-gold-bg); --goal-glow: rgba(255, 209, 102, 0.36); }
.ch-goal--stone { --goal: var(--dl-stone); --goal-soft: rgba(196, 165, 116, 0.14); --goal-glow: rgba(232, 196, 138, 0.34); }
.ch-goal--active { --goal: #7eb6ff; --goal-soft: rgba(126, 182, 255, 0.14); --goal-glow: rgba(126, 182, 255, 0.36); }

.ch-goal-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ch-goal-ring {
  --pct: 0;
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, rgba(10, 12, 18, 0.96) 67%, transparent 69%),
    conic-gradient(var(--goal) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.08) 0);
  box-shadow: 0 0 16px color-mix(in srgb, var(--goal-glow) 70%, transparent);
}

.ch-goal-card__ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--goal);
  background: var(--goal-soft);
}

.ch-goal-card__ico .pf-ico,
.ch-goal-card__ico .ch-ico {
  width: 18px;
  height: 18px;
}

.ch-goal-card__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.ch-goal-card__copy strong {
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.ch-goal-card__copy span {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--dl-text-muted);
}

.ch-goal-card em {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  font-style: normal;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  letter-spacing: -0.02em;
  color: var(--dl-text-secondary);
  white-space: nowrap;
}

.ch-goal-card__bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.ch-goal-card__bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--goal) 55%, #fff), var(--goal));
  box-shadow: 0 0 12px var(--goal-glow);
}

.ch-goal-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ch-goal-card__meta span {
  min-width: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--dl-text-muted);
}

.ch-goal-card__prize {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--dl-tint-gold-border);
  background: var(--dl-tint-gold-bg);
  color: var(--dl-gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ch-goal-card.is-done::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px var(--dl-tint-mint-border),
    0 0 22px rgba(47, 255, 193, 0.12);
}

.ch-goal-card.is-done em { color: var(--dl-mint); }

.ch-goal-card.is-done .ch-goal-card__prize {
  color: var(--dl-mint);
  border-color: var(--dl-tint-mint-border);
  background: var(--dl-tint-mint-bg);
}

.ch-goal-card.is-done .ch-goal-ring {
  --goal: var(--dl-mint);
  box-shadow: 0 0 18px rgba(47, 255, 193, 0.28);
}

.ch-goal-empty {
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 16px;
  border-radius: 18px;
  color: var(--dl-text-secondary);
  text-align: center;
}

.ch-goal-empty .pf-ico,
.ch-goal-empty .ch-ico {
  width: 28px;
  height: 28px;
  color: var(--dl-gold);
  opacity: 0.85;
}

.ch-goal-empty strong {
  font-size: 0.98rem;
  font-weight: 750;
  color: var(--dl-text-primary);
}

.ch-goal-empty span {
  font-size: 0.8rem;
  color: var(--dl-text-muted);
}

.ch-goal-note {
  margin: 0 4px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--dl-text-muted);
}

.ch-goal-card:nth-child(1) { animation: ch-in 0.28s var(--dl-ease-spring) both; }
.ch-goal-card:nth-child(2) { animation: ch-in 0.28s 0.06s var(--dl-ease-spring) both; }

.ch-vault__panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
}

.ch-vault__split {
  height: 1px;
  margin: 2px 0;
  background: rgba(255, 255, 255, 0.08);
}

.ch-vault__panel h3,
.ch-vault__log .ch-kicker {
  margin: 0;
}

.ch-vault__panel h3 {
  font-size: 0.95rem;
  font-weight: 700;
}

.ch-vault__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.ch-vault__log {
  padding: 14px 12px 12px;
  border-radius: 20px;
}

.ch-vault__log .ch-kicker {
  margin: 0 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 209, 102, 0.78);
}

.ch-vault__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-vault-tx {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 6.6rem;
  column-gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 214, 150, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ch-vault-tx__mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.ch-vault-tx__mark::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  transform: rotate(45deg);
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.ch-vault-tx--in .ch-vault-tx__mark {
  color: #3ddc84;
  background: radial-gradient(circle at 50% 40%, rgba(61, 220, 132, 0.28), rgba(61, 220, 132, 0.05) 72%);
  box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.38);
}

.ch-vault-tx--out .ch-vault-tx__mark {
  color: #ffb4c0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 77, 109, 0.24), rgba(255, 77, 109, 0.05) 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 180, 192, 0.34);
}

.ch-vault-tx__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ch-vault-tx strong {
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-vault-tx__who {
  min-width: 0;
  font-size: 0.74rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-vault-tx__who:empty { display: none; }

.ch-vault-tx__who--xfer {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: visible;
  white-space: normal;
  text-overflow: unset;
}

.ch-vault-tx__from,
.ch-vault-tx__to {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-vault-tx__to {
  color: rgba(255, 255, 255, 0.78);
}

.ch-vault-tx__to::before {
  content: "→ ";
  color: rgba(255, 255, 255, 0.38);
}

.ch-vault-tx__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.ch-vault-tx__amt {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  font-size: 0.98rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

.ch-vault-tx--in .ch-vault-tx__amt { color: #3ddc84; }
.ch-vault-tx--out .ch-vault-tx__amt { color: #ffb4c0; }

.ch-vault-tx time {
  font-size: 0.68rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--dl-text-muted);
  text-align: right;
  white-space: nowrap;
}

.ch-vault__empty {
  margin: 0;
  padding: 16px 4px 14px;
  text-align: center;
  color: var(--dl-text-muted);
  font-size: 0.85rem;
}

.ch-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ch-empty-card {
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--dl-text-secondary);
  text-align: center;
}

.ch-empty-card .pf-ico,
.ch-ico--lg { width: 28px; height: 28px; opacity: 0.8; }

.ch-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

.ch-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ch-filter-btn {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.ch-filter-btn.is-on {
  border-color: var(--dl-tint-cyan-border);
  background: var(--dl-tint-cyan-bg);
  color: var(--dl-cyan);
}

.ch-filter-income {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--dl-cyan);
}

.ch-page input[type="range"].ch-range {
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--dl-cyan);
}

#ch-filter-sheet {
  z-index: 80;
}

#ch-filter-sheet .ch-sheet__panel {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(400px, calc(100vw - 32px));
  max-height: min(72vh, 560px);
  margin: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translate(-50%, -50%);
}

.ch-row--3 { display: grid; grid-template-columns: 1fr 1fr auto; }

.ch-page input,
.ch-page textarea,
.ch-select {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
}

.ch-page textarea { min-height: 72px; resize: vertical; }
.ch-row input { flex: 1; min-width: 0; }

.ch-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--dl-text-muted);
}

.ch-btn,
.ch-iconbtn,
.ch-cta,
.ch-back {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ch-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}

a.ch-btn,
a.ch-btn:hover,
a.ch-btn:focus,
a.ch-btn:active {
  text-decoration: none;
}

.ch-btn--sm { min-height: 44px; min-width: 44px; padding: 0 10px; }
.ch-btn--ghost { background: transparent; }
.ch-btn--block { width: 100%; }
.ch-btn--accent {
  border-color: var(--dl-tint-cyan-border);
  background: var(--dl-tint-cyan-bg);
  color: var(--dl-cyan);
}

a.ch-btn--accent,
a.ch-btn--accent:hover,
a.ch-btn--accent:visited {
  color: var(--dl-cyan);
  text-decoration: none;
}
.ch-btn--danger {
  border-color: var(--dl-tint-coral-border);
  background: var(--dl-tint-coral-bg);
  color: var(--dl-coral-soft);
}

.ch-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ch-iconbtn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  color: inherit;
}

.ch-iconbtn .pf-ico,
.ch-iconbtn .ch-ico { width: 18px; height: 18px; }

.ch-cta {
  width: 100%;
  min-height: 56px;
  border-radius: 18px;
  border-color: var(--dl-tint-cyan-border);
  background: linear-gradient(135deg, rgba(92, 240, 255, 0.14), rgba(139, 108, 255, 0.16));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ch-cta .pf-ico { width: 18px; height: 18px; }

.ch-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dl-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
}

.ch-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.ch-picks { display: flex; flex-wrap: wrap; gap: 8px; }

#create-emblems.ch-picks,
#set-emblems.ch-picks,
#ci-emblem-logos.ch-picks {
  gap: 10px;
}

#create-emblems .ch-pick,
#set-emblems .ch-pick,
#ci-emblem-logos .ch-pick {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  overflow: hidden;
}

.ch-pick,
.ch-swatch {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 1.2rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.ch-pick.is-active,
.ch-swatch.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.ch-press {
  transition: transform 0.18s var(--dl-ease-spring);
  touch-action: manipulation;
}

.ch-press:active:not(:disabled) { transform: scale(0.97); }

.ch-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
}

.ch-sheet.is-on { display: block; }
.ch-sheet[hidden] { display: none !important; }

.ch-sheet__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 10, 16, 0.55);
}

.ch-sheet__panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dl-nav-offset) + env(safe-area-inset-bottom, 0px) + var(--tg-safe-area-inset-bottom, 0px));
  max-width: 420px;
  margin: 0 auto;
  padding: 14px;
  border-radius: 20px;
  animation: ch-fade 0.18s var(--dl-ease-spring);
}

.ch-sheet__title {
  margin: 0 0 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-sheet__actions { display: flex; flex-direction: column; gap: 8px; }
.ch-sheet__actions .ch-btn { width: 100%; }

.ch-error { margin: 0; color: var(--dl-coral-soft); font-size: 0.85rem; }

.ch-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 2100;
  max-width: min(92vw, 360px);
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(16, 18, 28, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 0.85rem;
  text-align: center;
  pointer-events: none;
}

.ch-toast.is-under-modal {
  transform: translateX(-50%);
}

.ch-toast.is-bad {
  color: var(--dl-coral-soft);
  background: rgba(42, 10, 18, 0.94);
  border-color: rgba(255, 77, 109, 0.55);
}

dialog[open] > .ch-toast {
  z-index: 5;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ch-stat,
  .ch-card,
  .ch-tab,
  .ch-hero,
  .ch-cta,
  .ch-sheet__panel,
  .ch-goal-bank,
  .ch-goal-card,
  .ch-goal-empty {
    background: var(--dl-glass-bg-fallback);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

html.tg-webapp .ch-card,
html.tg-webapp .ch-stat,
html.tg-webapp .ch-tab,
html.tg-webapp .ch-sheet__panel,
html.tg-webapp .ch-goal-bank,
html.tg-webapp .ch-goal-card,
html.tg-webapp .ch-goal-empty {
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

@media (prefers-reduced-motion: reduce) {
  .ch-panel.is-on,
  .ch-aux.is-on,
  .ch-gate-home.is-on,
  .ch-gate-form.is-on,
  .ch-view.is-on,
  .ch-sheet__panel,
  .ch-stage,
  .ch-menu.is-on .ch-menu__drop,
  .ch-goal-card,
  .ch-goal-bank__sum.is-bump { animation: none; transition: none; }
  .ch-press:active:not(:disabled) { transform: none; }
}

html.tactile-off .ch-press:active:not(:disabled) { transform: none; }

.dl-page > .ch-sheet {
  position: fixed;
  z-index: 30;
}
