/* NFT маркет — dark starry theme. Cards are semi-opaque glass without backdrop blur
   (blur over an animated canvas is re-rendered every frame — too heavy for Android);
   only the short-lived toast and small badges blur. */
:root {
  color-scheme: dark;
  --bg: #000000;
  --text: #f5f5f7;
  --hint: #9a9aa8;
  --link: #8ab4ff;
  --accent: #7c6cff;
  --accent-2: #3d8bff;
  --grad: linear-gradient(135deg, #8a63ff 0%, #4f7dff 55%, #2fa8ff 100%);
  --button: #5b74ff;
  --button-text: #ffffff;
  --glass: rgba(16, 16, 28, 0.74);
  --glass-2: rgba(28, 28, 44, 0.82);
  --field: rgba(8, 8, 16, 0.72);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --destructive: #ff5a5f;
  --ok: #34d399;
  --warn: #fbbf24;
  --gold: #ffd66b;
  --radius: 16px;
  --radius-sm: 12px;
  --safe-top: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; padding: 0; color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { background: transparent; min-height: 100vh; padding-bottom: calc(28px + var(--safe-bottom)); overscroll-behavior-y: none; }
a { color: var(--link); text-decoration: none; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 22px 4px 10px; }
button { font-family: inherit; }

/* --- starry sky ------------------------------------------------------------ */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #000; }
.sky canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.nebula { position: absolute; inset: -20%; opacity: .9;
  background:
    radial-gradient(38% 28% at 18% 12%, rgba(110, 72, 255, .20), transparent 70%),
    radial-gradient(34% 26% at 88% 30%, rgba(40, 110, 255, .16), transparent 70%),
    radial-gradient(45% 32% at 60% 92%, rgba(150, 60, 220, .14), transparent 70%),
    radial-gradient(30% 22% at 8% 70%, rgba(30, 160, 255, .08), transparent 70%);
  animation: nebula 60s ease-in-out infinite alternate; will-change: transform; }
@keyframes nebula { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-3%, 2%, 0) scale(1.06); } }
.appbar, main, .toast, .modal { position: relative; z-index: 1; }

/* --- header + tabs --------------------------------------------------------- */
.appbar { position: sticky; top: 0; z-index: 10; padding-top: var(--safe-top);
  /* no backdrop blur here: it would be recomputed every frame over the animated sky */
  background: linear-gradient(180deg, rgba(0, 0, 0, .94), rgba(4, 4, 12, .86));
  border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; white-space: nowrap; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-size: 15px; color: #fff;
  background: var(--grad); box-shadow: 0 0 18px rgba(124, 108, 255, .55); }
.balance-chip { border: 1px solid var(--line-2); background: rgba(124, 108, 255, .14); color: var(--text); padding: 6px 12px;
  border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(124, 108, 255, .08), 0 4px 18px rgba(80, 90, 255, .18); transition: transform .15s var(--ease); }
.balance-chip:active { transform: scale(.96); }
.tabs { display: flex; gap: 6px; padding: 6px 12px 10px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 13px; white-space: nowrap; background: rgba(255, 255, 255, .04); color: var(--hint); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease); }
.tab .ico { font-size: 15px; line-height: 1; filter: saturate(.6); transition: filter .2s; }
.tab:active { transform: scale(.95); }
.tab.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 16px rgba(91, 116, 255, .38); }
.tab.active .ico { filter: none; }

/* --- layout ---------------------------------------------------------------- */
main { padding: 10px 12px 0; max-width: 760px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: pageIn .26s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-between h2 { margin-left: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.top-gap { margin-top: 12px; }
.pad { margin: -2px 4px 12px; }
.pad.top-gap { margin-top: 12px; }
.muted { color: var(--hint); } .small { font-size: 12.5px; }

/* --- cards ----------------------------------------------------------------- */
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .03); }
.form-card { margin-top: 8px; }
.form-card + .form-card { margin-top: 14px; }
.form-card h2 { margin: 0 0 6px; }
.notice { background: rgba(124, 108, 255, .10); border: 1px solid rgba(124, 108, 255, .28); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 2px 0 12px; font-size: 13px; color: #d9d6ff; }

/* --- inputs ---------------------------------------------------------------- */
.toolbar { display: flex; gap: 8px; margin: 2px 0 10px; }
.search-box { position: relative; flex: 1 1 auto; min-width: 0; }
.search-box::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--hint); font-size: 18px; pointer-events: none; }
.search-box .input { padding-left: 34px; }
.input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; font-size: 15px; font-family: inherit;
  background: var(--glass); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s, background .2s; -webkit-appearance: none; appearance: none; }
.input::placeholder { color: #6e6e7c; }
.input:focus { border-color: rgba(124, 108, 255, .8); box-shadow: 0 0 0 3px rgba(124, 108, 255, .22); }
select.input { padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.select { width: auto; flex: 0 0 auto; }
.card .input { background-color: var(--field); }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--hint); margin: 12px 2px 5px; letter-spacing: .01em; }
.hint { font-size: 12px; color: var(--hint); margin: 6px 2px 0; min-height: 16px; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* --- buttons --------------------------------------------------------------- */
.btn { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 14px; font-weight: 650; font-size: 14.5px; cursor: pointer;
  background: rgba(255, 255, 255, .06); color: var(--text); transition: transform .12s var(--ease), filter .2s, background .2s, opacity .2s; }
.btn:active:not([disabled]) { transform: scale(.97); }
.btn.primary { background: var(--grad); color: var(--button-text); border-color: transparent; width: 100%; margin-top: 14px; padding: 13px 14px; font-size: 15.5px;
  box-shadow: 0 6px 20px rgba(91, 116, 255, .35); }
.btn.primary:active:not([disabled]) { filter: brightness(1.12); }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.ghost { background: transparent; color: var(--link); border-color: transparent; }
.btn.danger { color: var(--destructive); background: rgba(255, 90, 95, .08); border-color: rgba(255, 90, 95, .25); }
.btn.ok { background: rgba(52, 211, 153, .16); color: #7ff0c4; border-color: rgba(52, 211, 153, .35); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- segmented control ----------------------------------------------------- */
.seg { display: flex; gap: 4px; background: var(--glass); border: 1px solid var(--line); border-radius: 13px; padding: 4px; margin: 0 0 12px; }
.seg.compact { margin: 0; }
.seg-btn { flex: 1 1 0; border: 0; border-radius: 9px; padding: 7px 8px; background: transparent; color: var(--hint); font-weight: 650; font-size: 13px;
  cursor: pointer; white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease); }
.seg-btn.active { background: rgba(124, 108, 255, .28); color: #fff; box-shadow: inset 0 0 0 1px rgba(150, 135, 255, .45); }

/* --- market grid + gift cards ---------------------------------------------- */
.filters { margin: 6px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; margin-top: 10px; }
.gift { display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 10px; min-width: 0; position: relative; overflow: hidden;
  transition: transform .18s var(--ease), border-color .2s, box-shadow .2s; }
.grid > .gift { animation: rise .34s var(--ease) both; }
.grid > .gift:nth-child(2) { animation-delay: .03s; } .grid > .gift:nth-child(3) { animation-delay: .06s; }
.grid > .gift:nth-child(4) { animation-delay: .09s; } .grid > .gift:nth-child(5) { animation-delay: .12s; }
.grid > .gift:nth-child(6) { animation-delay: .15s; } .grid > .gift:nth-child(n+7) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.gift::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(160deg, rgba(160, 140, 255, .35), rgba(255, 255, 255, 0) 40%, rgba(60, 140, 255, .18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.gift:active { transform: scale(.985); }
.gift .thumb { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 46px; background: radial-gradient(circle at 50% 35%, rgba(124, 108, 255, .28), rgba(10, 10, 20, .9) 70%); }
.gift .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s var(--ease); }
.gift:active .thumb img { transform: scale(1.03); }
.gift .title { font-weight: 700; font-size: 14px; margin-top: 2px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gift .meta { color: var(--hint); font-size: 11.5px; min-height: 16px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gift .fee { color: var(--hint); font-size: 11px; padding: 0 2px; }
.gift .floor { color: var(--hint); font-size: 11px; padding: 0 2px; min-height: 15px; }
.gift .floor.good { color: var(--ok); }
.rarity { color: var(--gold); font-weight: 600; }
.badge { position: absolute; top: 7px; left: 7px; z-index: 1; background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 999px; border: 1px solid var(--line-2); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gift .prices { display: flex; flex-wrap: wrap; gap: 4px; min-height: 24px; padding: 0 1px; }
.gift .actions { display: flex; gap: 6px; min-width: 0; margin-top: 2px; }
.gift .btn { width: 100%; background: var(--grad); color: var(--button-text); border-color: transparent; box-shadow: 0 4px 14px rgba(91, 116, 255, .28); }
.gift .actions .btn { flex: 1 1 auto; min-width: 0; width: auto; padding: 9px 6px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gift .actions .btn.offer { flex: 0 0 40px; width: 40px; padding-left: 0; padding-right: 0; background: rgba(255, 255, 255, .07); color: var(--text);
  border-color: var(--line-2); box-shadow: none; }
.gift .btn.mine, .gift .btn[disabled] { background: rgba(255, 255, 255, .06); color: var(--hint); box-shadow: none; border-color: var(--line); }

/* price chips per currency */
.chip { display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; padding: 2px 8px; font-size: 11.5px; font-weight: 700;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.main { font-size: 13.5px; padding: 3px 10px; }
.chip.cur-XTR { color: var(--gold); background: rgba(255, 200, 60, .10); border-color: rgba(255, 200, 60, .30); }
.chip.cur-UAH { color: #9cc8ff; background: rgba(70, 140, 255, .10); border-color: rgba(70, 140, 255, .30); }
.chip.cur-USDT { color: #5fe3b6; background: rgba(38, 161, 123, .12); border-color: rgba(38, 161, 123, .34); }
.chip.cur-TON { color: #6ccdff; background: rgba(0, 152, 234, .12); border-color: rgba(0, 152, 234, .34); }
.price { font-weight: 700; }

/* --- lists ----------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list > .card { animation: rise .28s var(--ease) both; }
.item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px 14px; }
.item .main { min-width: 0; flex: 1 1 auto; }
.item .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12px; color: var(--hint); margin-top: 2px; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.col { flex-direction: column; align-items: stretch; }
.item.col .actions { justify-content: flex-start; margin-top: 8px; }
.status { display: inline-block; margin-top: 5px; font-size: 11.5px; font-weight: 650; white-space: nowrap; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); }
.status.ok { color: var(--ok); background: rgba(52, 211, 153, .10); }
.status.warn { color: var(--warn); background: rgba(251, 191, 36, .10); }
.status.bad { color: var(--destructive); background: rgba(255, 90, 95, .10); }
.coll-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; cursor: pointer; }
.coll-head .price { color: var(--gold); white-space: nowrap; font-size: 13.5px; }
.coll-sales { margin-top: 8px; font-size: 13px; }
.coll-sales div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.coll-sales div span:last-child { text-align: right; }
.err { color: var(--destructive); font-size: 12px; margin-top: 3px; }
.steps { margin-top: 14px; font-size: 13px; color: var(--hint); background: rgba(255, 255, 255, .03); border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm); padding: 10px 12px; }
.steps b { color: var(--text); }
.steps ol { margin: 6px 0 0; padding-left: 18px; }
.steps li + li { margin-top: 4px; }

/* --- empty states, skeletons ---------------------------------------------- */
.empty { text-align: center; color: var(--hint); padding: 28px 16px; font-size: 14px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  background: rgba(10, 10, 20, .45); }
.empty-ico { font-size: 30px; margin-bottom: 6px; filter: drop-shadow(0 0 10px rgba(124, 108, 255, .5)); }
.list .empty { padding: 18px 14px; font-size: 13.5px; }
.grid .empty, #marketEmpty { margin-top: 12px; }
.skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, .06); border-radius: 8px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .08), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-card { pointer-events: none; }
.skel-card .skel.thumb { aspect-ratio: 1 / 1; border-radius: 12px; }
.skel-line { height: 12px; margin-top: 8px; }
.skel-line.w60 { width: 60%; } .skel-line.w40 { width: 40%; } .skel-line.w80 { width: 80%; }
.skel-btn { height: 34px; margin-top: 10px; border-radius: 10px; }

/* --- balances, stats ------------------------------------------------------- */
.balance-card { text-align: center; margin-top: 8px; padding: 18px 14px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(124, 108, 255, .25), rgba(18, 18, 30, .85) 60%); }
.big { font-size: 34px; font-weight: 800; margin: 4px 0; letter-spacing: -0.02em; text-shadow: 0 0 24px rgba(255, 214, 107, .35); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.stat-row > div { background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 10px 4px; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-grid .card { padding: 12px; }
.stat-grid .stat-value { font-size: 18px; margin-top: 2px; }
.wallet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
.wallet-card { text-align: left; position: relative; overflow: hidden; }
.wallet-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; opacity: .5;
  background: radial-gradient(circle, var(--wc, rgba(124, 108, 255, .5)), transparent 70%); pointer-events: none; }
.wallet-card.cur-XTR { --wc: rgba(255, 200, 60, .45); } .wallet-card.cur-UAH { --wc: rgba(70, 140, 255, .45); }
.wallet-card.cur-USDT { --wc: rgba(38, 161, 123, .5); } .wallet-card.cur-TON { --wc: rgba(0, 152, 234, .5); }
.wallet-card .stat-value { font-size: 19px; word-break: break-all; margin: 4px 0 2px; }
.wallet-card .btn { margin-top: 10px; width: 100%; }
.ref-link { background: var(--field); border-radius: var(--radius-sm); padding: 11px 12px; font-size: 13px; word-break: break-all; border: 1px solid var(--line-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #cfd3ff; }
.topup-result { margin-top: 14px; background: var(--field); border: 1px solid rgba(124, 108, 255, .3); border-radius: var(--radius-sm); padding: 12px; font-size: 13px;
  animation: rise .3s var(--ease) both; }
.topup-result .row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
.topup-result code { color: var(--gold); font-size: 14px; word-break: break-all; text-align: right; }
.topup-result .btn { margin-top: 6px; }

/* --- bottom sheet modal ---------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .74); z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  animation: dimIn .2s ease both; }
.modal[hidden] { display: none; }
@keyframes dimIn { from { background-color: rgba(0, 0, 0, 0); } }
.modal-card { position: relative; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 16px calc(18px + var(--safe-bottom));
  max-height: min(86vh, calc(var(--tg-viewport-stable-height, 100vh) - 24px)); overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, #1c1a32, #0e0e18); border-top: 1px solid rgba(160, 140, 255, .35);
  box-shadow: 0 -12px 40px rgba(60, 50, 160, .35); animation: sheetUp .3s var(--ease) both; }
.modal-card::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: rgba(255, 255, 255, .22); }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-card h3 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.01em; }
.modal-card h2 { font-size: 15px; margin: 16px 0 6px; }
.modal-close { width: 100%; margin-top: 10px; }
.cur-choice { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cur-choice .btn { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 0; padding: 13px 14px; }
.cur-choice .btn .muted, .cur-choice .btn .small { font-weight: 500; opacity: .85; }
.cur-choice .btn:not(.primary) { background: rgba(255, 255, 255, .05); }
.cur-choice .btn .chip { font-size: 14px; }

/* --- toast ----------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-bottom)); transform: translateX(-50%); max-width: min(92%, 480px); width: max-content;
  z-index: 40; text-align: center; padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; color: #fff;
  background: rgba(28, 28, 44, .92); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: toastIn .28s var(--ease) both; }
.toast[hidden] { display: none; }
.toast.ok { border-color: rgba(52, 211, 153, .45); }
.toast.bad { border-color: rgba(255, 90, 95, .5); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .nebula { animation: none; }
}

/* --- searchable filter picker ------------------------------------------------ */
.picker-field { position: relative; }
.picker-native { position: absolute !important; inset: 0; opacity: 0; pointer-events: none; }
.picker-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; padding-right: 32px; min-height: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--hint) 50%), linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.card .picker-btn { background-color: var(--field); }
.picker-btn .pk-val { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--hint); }
.picker-btn.set { border-color: rgba(124, 108, 255, .55); }
.picker-btn.set .pk-val { color: var(--text); font-weight: 600; }
.picker-btn:active { transform: scale(.985); }
.pk-sw { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18), 0 0 10px rgba(0, 0, 0, .35); }
.picker-btn .pk-sw { width: 18px; height: 18px; }
.picker-card { display: flex; flex-direction: column; height: min(78vh, calc(var(--tg-viewport-stable-height, 100vh) - 40px)); padding-bottom: 0; overflow: hidden; }
.picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.picker-head h3 { margin: 0; font-size: 18px; }
.picker-card .search-box { flex: 0 0 auto; }
.picker-card .search-box .input { background-color: var(--field); }
.picker-card #pickerHint { margin: 8px 2px 0; min-height: 0; }
.picker-list { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  margin: 10px -16px 0; padding: 0 10px calc(14px + var(--safe-bottom)); }
.pk-group { position: sticky; top: 0; z-index: 1; padding: 10px 8px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--hint); background: linear-gradient(180deg, #17162a 70%, rgba(23, 22, 42, 0)); }
.pk-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 9px 10px; border: 0; border-radius: 14px;
  background: transparent; color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; transition: background .15s; }
.pk-item + .pk-item { margin-top: 2px; }
.pk-item:active { background: rgba(255, 255, 255, .06); }
.pk-item.active { background: linear-gradient(90deg, rgba(124, 108, 255, .28), rgba(64, 140, 255, .14)); box-shadow: inset 0 0 0 1px rgba(140, 125, 255, .45); }
.pk-item.active .pk-name::after { content: " ✓"; color: #b8adff; }
.pk-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-meta { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pk-rar { font-size: 12px; color: var(--hint); font-variant-numeric: tabular-nums; }
.pk-count { min-width: 24px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; text-align: center;
  color: #0b0b14; background: var(--gold); }
.pk-more { text-align: center; padding: 10px 0; }
.picker-list .empty { margin: 18px 6px; }
.credit { margin: 12px 2px 0; font-size: 11.5px; color: var(--hint); opacity: .8; }
.credit a { color: #a99cff; text-decoration: none; }
