#dialog:has(.wallet-sheet) {
  --wallet-surface:#1b181f;
  --wallet-inset:#242029;
  --wallet-line:#423948;
  --wallet-soft:#c3b8cd;
  --wallet-accent:#cfb0ff;
  width:min(424px,calc(100% - 32px));
  max-height:min(88dvh,calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 20px));
  padding:0;
  border:0;
  border-radius:20px;
  background:var(--wallet-surface);
  box-shadow:0 24px 76px #08060daa;
  overflow:hidden;
  color:#f8f5fb;
}
#dialog[open]:has(.wallet-sheet) {display:flex;flex-direction:column}
html:has(#dialog[open] .wallet-sheet) {overflow:hidden}
#dialog:has(.wallet-sheet)::backdrop {background:#08060dc4;backdrop-filter:blur(5px)}
#dialog:has(.wallet-sheet) .dialog-head {
  flex:none;
  margin:0;
  padding:14px 14px 9px 22px;
}
#dialog:has(.wallet-sheet) h2 {font:760 26px/1.12 Barlow,Inter,sans-serif;letter-spacing:-.025em}
#dialog:has(.wallet-sheet) h2:focus {outline:0}
#dialog:has(.wallet-sheet) #close-dialog {
  display:grid;place-items:center;width:44px;height:44px;min-height:44px;
  padding:0;border:0;border-radius:50%;background:transparent;color:var(--wallet-soft);
}
#dialog:has(.wallet-sheet) #close-dialog i {
  display:grid;place-items:center;width:29px;height:29px;background:#302a35;border-radius:50%;
}
#dialog:has(.wallet-sheet) #close-dialog svg {width:15px;height:15px}
#dialog:has(.wallet-sheet) #dialog-body {
  min-height:0;overflow:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-color:#65556e var(--wallet-surface);
}
.wallet-sheet {padding:0 22px 20px;font-size:14px;line-height:1.35}
.wallet-sheet svg {width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.wallet-sheet button,.wallet-sheet a {touch-action:manipulation}
.wallet-sheet button:disabled {cursor:default}
.wallet-sheet :is(button,a,input):focus-visible {outline:2px solid #e4caff;outline-offset:2px}
.wallet-sheet h3,.wallet-form label {display:block;font:690 15px/1.35 Inter,sans-serif;letter-spacing:-.02em;margin:0}
.wallet-tabs,.wallet-methods,.wallet-packs {display:grid;gap:7px}
.wallet-tabs {
  grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;
  padding:3px;border-radius:12px;background:#120f16;
}
.wallet-tabs button {
  display:flex;gap:7px;align-items:center;justify-content:center;
  min-height:42px;border-radius:9px;padding:4px 6px;color:var(--wallet-soft);font-weight:650;
}
.wallet-tabs [aria-selected=true] {background:#38303f;color:#faf6ff}
.wallet-tabs [aria-selected=true] svg {color:#dbbdff}
.wallet-balance {
  position:relative;isolation:isolate;overflow:hidden;margin:12px 0 17px;
  padding:14px 16px 13px;border-radius:14px;
  background:linear-gradient(110deg,#302637 0%,#382b43 51%,#604776 100%);
}
.wallet-balance::before {
  position:absolute;z-index:-1;content:"";inset:0 0 0 auto;
  width:46%;background:linear-gradient(100deg,#76608e,#b48bd2);
  -webkit-mask:url(brand.svg) right -7px center / 148px 148px no-repeat;
  mask:url(brand.svg) right -7px center / 148px 148px no-repeat;
  opacity:.72;
}
.wallet-balance-label,.wallet-demo {display:block;position:relative;width:fit-content;color:#e6d6ef}
.wallet-balance-label {font-size:13px;font-weight:580}
.wallet-figure {display:flex;align-items:center;gap:7px;margin:2px 0 4px;width:fit-content}
.wallet-figure strong {font:710 32px/1.15 Inter,sans-serif;letter-spacing:-.035em;font-variant-numeric:tabular-nums}
.wallet-figure span,.wallet-stars-icon {color:#ffd389}
.wallet-figure span {font-size:20px}
.wallet-demo {font-size:12px}
.wallet-methods {grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:17px}
.wallet-methods button {
  display:flex;align-items:center;gap:8px;min-width:0;min-height:44px;padding:9px 11px;
  background:var(--wallet-inset);border:1px solid var(--wallet-line);border-radius:10px;
  color:#e2d9ea;font-weight:660;text-align:left;
}
.wallet-methods button::after {
  content:"";margin-left:auto;width:13px;height:13px;border-radius:50%;border:1px solid #776c80;
}
.wallet-methods [aria-pressed=true] {background:#312638;border-color:#967cad;color:#f6edff}
.wallet-methods [aria-pressed=true]::after {background:var(--wallet-accent);border:3px solid #312638;outline:1px solid var(--wallet-accent);width:9px;height:9px}
.wallet-methods svg {color:#bda0db;width:17px;height:17px}
.wallet-stars-icon {font-size:17px;line-height:1}
.wallet-field {
  margin-top:7px;display:flex;align-items:center;min-height:46px;
  border:1px solid var(--wallet-line);border-radius:10px;background:#151218;
}
.wallet-field:focus-within {border-color:var(--wallet-accent)}
.wallet-field input {
  flex:1;min-width:0;align-self:stretch;padding:9px 12px;background:transparent;color:#faf6fc;
  border:0;border-radius:9px;font:650 18px/1.2 Inter,sans-serif;caret-color:var(--wallet-accent);
  font-variant-numeric:tabular-nums;
}
.wallet-field input::placeholder {color:#b4a7bf;font-weight:480}
.wallet-field input:focus-visible {outline:0}
.wallet-field>span {padding-right:12px;color:var(--wallet-soft);font-weight:550;font-size:13px}
.wallet-form h3 {margin:14px 0 7px}
.wallet-packs {grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.wallet-pack {
  position:relative;display:grid;align-content:center;justify-items:center;gap:4px;
  min-height:58px;min-width:0;padding:6px 2px;border:1px solid var(--wallet-line);border-radius:9px;
  background:var(--wallet-inset);color:#e3d9ea;font:660 16px/1.15 Inter,sans-serif;font-variant-numeric:tabular-nums;
}
.wallet-pack::before {
  content:"";display:block;width:13px;height:13px;
  background:#ba9b74;clip-path:polygon(50% 0,64% 33%,99% 37%,73% 61%,80% 98%,50% 80%,18% 98%,25% 61%,0 37%,36% 33%);
}
.wallet-pack[aria-pressed=true] {border-color:#cfb382;background:#3d3429;color:#ffe1ae}
.wallet-pack[aria-pressed=true]::before {background:#ffcf82}
.wallet-action,.wallet-free {
  width:100%;min-height:44px;border-radius:10px;padding:10px;
  color:#261b31;background:var(--wallet-accent);font-weight:710;
}
.wallet-action {margin-top:16px}
.wallet-action:disabled {color:#c3b8cc;background:#302a35}
.wallet-link {
  display:inline-flex;align-items:center;min-height:44px;padding:7px 3px;
  color:#dfc2ff;font-weight:620;text-decoration:underline;text-underline-offset:3px;
}
.wallet-extra:not(:empty) {text-align:center;margin:1px 0 -7px}
#dialog-body .wallet-note {margin:6px 0 0;color:var(--wallet-soft);font-size:13px;line-height:1.45}
.wallet-form>.wallet-note {text-align:center}
.wallet-shortfall {margin:-3px 0 15px}
.wallet-free {margin-top:7px}
.wallet-skins {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:12px}
.wallet-skin {
  position:relative;display:flex;flex-direction:column;align-items:stretch;min-width:0;
  border:1px solid var(--wallet-line);border-radius:10px;background:var(--wallet-inset);text-align:left;padding:5px 8px 8px;
}
.wallet-skin[aria-pressed=true] {border-color:var(--wallet-accent);background:#35293e}
.wallet-skin img {display:block;width:100%;height:49px;object-fit:contain}
.wallet-skin small {color:var(--wallet-soft);font-size:11px}
.wallet-skin strong {font-size:13px;line-height:1.3;margin:2px 0 6px;overflow-wrap:anywhere}
.wallet-skin b {margin-top:auto;color:#e6c2ff;font-size:12px}
.wallet-estimate {
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  border-top:1px solid var(--wallet-line);padding-top:11px;margin-top:10px;
}
.wallet-estimate span {color:var(--wallet-soft);font-size:13px}
.wallet-estimate strong {font:680 17px/1.2 Inter,sans-serif}
.wallet-unavailable,.wallet-empty {padding:15px;background:var(--wallet-inset);border-radius:12px}
.wallet-empty {display:grid;justify-items:center;margin-top:13px;text-align:center;gap:5px}
.wallet-empty svg {color:var(--wallet-accent);width:25px;height:25px}
.wallet-empty .wallet-link {margin:-4px 0 -7px}
.wallet-history:not(:empty) {margin-top:16px;padding-top:14px;border-top:1px solid var(--wallet-line)}
.wallet-receipts {list-style:none;padding:0;margin:4px 0}
.wallet-receipts li {display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding:8px 0;font-size:13px}
.wallet-receipts li+li {border-top:1px solid var(--wallet-line)}
.wallet-receipts strong {white-space:nowrap}
@media(hover:hover) {
  .wallet-sheet button:hover:not(:disabled),#dialog:has(.wallet-sheet) #close-dialog:hover i {filter:brightness(1.15)}
}
@media(max-width:600px) {
  #dialog:has(.wallet-sheet),html.telegram #dialog:has(.wallet-sheet) {
    position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:100%;
    max-height:min(calc(100dvh - var(--safe-top) - 8px),calc(var(--app-height) - var(--safe-top) - 8px));
    border-radius:20px 20px 0 0;
  }
  #dialog:has(.wallet-sheet) .dialog-head {padding:8px calc(11px + var(--safe-right)) 6px calc(17px + var(--safe-left))}
  .wallet-sheet {padding:0 calc(17px + var(--safe-right)) calc(15px + var(--safe-bottom)) calc(17px + var(--safe-left))}
  .wallet-tabs button {min-height:44px}
}
@media(max-width:360px) {
  .wallet-balance::before {width:35%;mask-size:105px 105px}
  .wallet-skin {padding:4px 6px 7px}
}
@media(prefers-reduced-motion:no-preference) {
  #dialog[open]:has(.wallet-sheet) {animation:wallet-appear .22s cubic-bezier(.16,1,.3,1)}
  .wallet-tabs button,.wallet-methods button,.wallet-skin,.wallet-pack {transition:background-color .16s,border-color .16s,color .16s}
  @keyframes wallet-appear {from {opacity:.6;transform:translateY(10px)}}
}

.sp-wallet {display:grid;gap:12px}
.sp-wallet input[type=url] {min-width:0;width:100%;padding:12px;background:#1b1921;color:inherit;border:1px solid #494152;border-radius:10px}
.sp-row,.sp-check {display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:14px}
.sp-row strong {text-align:right}
.sp-check {justify-content:flex-start}
.sp-wallet .wallet-link {text-align:left;min-height:38px}
