/* ============================================================
   MONO SHOP — black & white design system for Telegram Mini App
   ============================================================ */

:root {
  --bg: #050505;
  --surface: #101010;
  --surface-2: #181818;
  --surface-3: #202020;
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #f5f5f5;
  --text-dim: #9a9a9a;
  --text-faint: #5c5c5c;
  --invert-bg: #f5f5f5;
  --invert-text: #0a0a0a;
  --danger: #ff5c5c;
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 22px;
  --radius-full: 999px;
  --nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease-spring: cubic-bezier(0.32, 1.25, 0.32, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Unbounded", "Space Grotesk", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-num: "Space Mono", "JetBrains Mono", ui-monospace, monospace;
  --grad-iris: linear-gradient(115deg, #8e7dff, #4fc3f7, #7affd4, #ffd479, #ff8ea1, #8e7dff);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

/* ---------- ambient aurora ---------- */
body::after {
  content: "";
  position: fixed;
  inset: -30%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background:
    radial-gradient(38% 30% at 18% 22%, rgb(142 125 255 / 0.14), transparent 70%),
    radial-gradient(34% 26% at 82% 14%, rgb(79 195 247 / 0.10), transparent 70%),
    radial-gradient(40% 32% at 70% 82%, rgb(122 255 212 / 0.08), transparent 70%),
    radial-gradient(30% 26% at 22% 78%, rgb(255 142 161 / 0.07), transparent 70%);
  filter: blur(28px);
  animation: aurora-drift 26s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  0%   { transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(3%, 3%, 0) rotate(4deg) scale(1.08); }
  100% { transform: translate3d(-2%, 4%, 0) rotate(-3deg) scale(1.03); }
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font-family: inherit; color: var(--text); }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- grain overlay ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- falling credit cards backdrop ---------- */
#cards-rain {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.rain-card {
  position: absolute;
  top: -70px;
  left: var(--x, 50%);
  width: var(--w, 56px);
  height: calc(var(--w, 56px) * 0.63);
  border-radius: 6px;
  background: linear-gradient(135deg, #1d1d1d 0%, #121212 55%, #1a1a1a 100%);
  border: 1px solid rgb(255 255 255 / 0.10);
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.5);
  opacity: 0;
  animation: card-fall var(--dur, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
  will-change: transform;
}

/* chip */
.rain-card::before {
  content: "";
  position: absolute;
  top: 26%;
  left: 12%;
  width: 22%;
  height: 24%;
  border-radius: 2px;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.4), rgb(255 255 255 / 0.14));
}

/* number strip + magnetic band */
.rain-card::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 18%;
  height: 8%;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg,
      rgb(255 255 255 / 0.32) 0 6%,
      transparent 6% 12%);
}

@keyframes card-fall {
  0% {
    transform: translateY(-10vh) rotate(var(--r0, -18deg));
    opacity: 0;
  }
  8% { opacity: var(--op, 0.16); }
  90% { opacity: var(--op, 0.16); }
  100% {
    transform: translateY(115vh) rotate(var(--r1, 26deg));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rain-card { animation: none; opacity: 0; }
}

/* ---------- app shell ---------- */
#app {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 28px);
  min-height: 100dvh;
  transition: transform 0.38s var(--ease-spring), opacity 0.38s var(--ease-out), filter 0.38s var(--ease-out);
  transform-origin: 50% 0;
}
/* app "falls back" when a sheet slides over it */
#app.sheet-behind {
  transform: scale(0.955) translateY(6px);
  opacity: 0.6;
  filter: saturate(0.8);
}

/* ---------- views / tab transitions ---------- */
.view { display: none; }
.view.active { display: block; animation: view-in 0.32s var(--ease-out) both; }
.view.active.slide-left { animation: view-slide-left 0.34s var(--ease-out) both; }
.view.active.slide-right { animation: view-slide-right 0.34s var(--ease-out) both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes view-slide-left {
  from { opacity: 0; transform: translateX(72px); }
  55% { opacity: 1; }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes view-slide-right {
  from { opacity: 0; transform: translateX(-72px); }
  55% { opacity: 1; }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view.active,
  .view.active.slide-left,
  .view.active.slide-right { animation: none; }
}

.view-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  text-wrap: balance;
  color: var(--text);
  animation: title-in 0.45s var(--ease-out) both;
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(10px); clip-path: inset(0 0 100% 0); }
  to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 -20% 0); }
}
.view-sub { color: var(--text-dim); font-size: 13px; margin: -10px 0 16px; }

/* ---------- search ---------- */
.search-wrap {
  position: relative;
  margin-bottom: 18px;
  animation: view-in 0.4s var(--ease-out) both;
}
.search-wrap input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 13px 48px 13px 18px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input::placeholder { color: var(--text-faint); }
.search-wrap input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgb(255 255 255 / 0.05);
}
.search-wrap .search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
  display: flex;
}

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
@media (min-width: 480px) { .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.18s;
  animation: card-in 0.45s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.card:active { transform: scale(0.965); border-color: var(--border-strong); }
.card:active .card-img img { transform: scale(1.07); filter: grayscale(0.3); }

.card-img {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  animation: img-in 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms + 80ms);
  transition: transform 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}
@keyframes img-in {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}
.card-img .noimg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.card-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgb(5 5 5 / 0.8);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
}
.card-badge.sold-out { color: var(--text-dim); }

.card-body { padding: 11px 12px 13px; }
.card-name { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.card-desc {
  font-family: var(--font-display);
  font-weight: 300;
  color: var(--text-dim);
  font-size: 10.5px;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}
.card-price {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-family: var(--font-num);
}

/* skeletons */
.skeleton {
  border-radius: var(--radius-m);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}
.skeleton .sk-img { aspect-ratio: 1/1; }
.skeleton .sk-line { height: 12px; border-radius: 6px; margin: 10px 12px; }
.sk-shimmer {
  background: linear-gradient(100deg, var(--surface-2) 40%, var(--surface-3) 50%, var(--surface-2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 64px 20px;
  animation: view-in 0.35s var(--ease-out) both;
}
.empty-state svg { margin: 0 auto 14px; color: var(--text-faint); }
.empty-state .big { font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* ---------- bottom navigation ---------- */
.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 12px);
  width: min(calc(100% - 24px), 420px);
  background: rgb(16 16 16 / 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  display: flex;
  padding: 6px;
  z-index: 50;
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.6);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 7px;
  border-radius: var(--radius-m);
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  position: relative;
  transition: color 0.22s, background 0.22s;
}
.nav-btn svg { transition: transform 0.28s var(--ease-spring); }
.nav-btn.active { color: var(--invert-text); background: var(--invert-bg); animation: nav-pill-in 0.34s var(--ease-spring) both; }
.nav-btn.active svg { transform: translateY(-1px) scale(1.08); animation: nav-icon-pop 0.42s var(--ease-spring); }
.nav-btn:active svg { transform: scale(0.88); }
@keyframes nav-pill-in {
  from { transform: scale(0.9); }
  60% { transform: scale(1.04); }
  to { transform: scale(1); }
}
@keyframes nav-icon-pop {
  0% { transform: translateY(2px) scale(0.85); }
  55% { transform: translateY(-2px) scale(1.18); }
  100% { transform: translateY(-1px) scale(1.08); }
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: calc(50% - 22px);
  min-width: 17px;
  height: 17px;
  border-radius: var(--radius-full);
  background: var(--invert-bg);
  color: var(--invert-text);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
  transform: scale(0);
  transition: transform 0.3s var(--ease-spring);
}
.nav-btn.active .nav-badge { background: var(--invert-text); color: var(--invert-bg); border-color: var(--invert-bg); }
.nav-badge.show { transform: scale(1); }
.nav-badge.pulse { animation: badge-pulse 0.45s var(--ease-spring); }
@keyframes badge-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ---------- cart ---------- */
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-row {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 10px;
  align-items: center;
  animation: card-in 0.4s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 50ms);
  transition: opacity 0.25s, transform 0.25s;
}
.cart-row.removing { opacity: 0; transform: translateX(40px); }
.cart-thumb {
  width: 58px; height: 58px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
.cart-info { flex: 1; min-width: 0; }
.cart-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-unit { color: var(--text-dim); font-size: 12px; }
.cart-sub { font-weight: 700; font-size: 15px; margin-top: 2px; font-family: var(--font-num); }

.qty {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
}
.qty button {
  width: 28px; height: 28px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.qty button:active { background: var(--surface-3); color: var(--text); transform: scale(0.88); }
.qty .qty-n {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
}
.qty .qty-n.bump { animation: qty-bump 0.3s var(--ease-spring); }
@keyframes qty-bump { 40% { transform: scale(1.35); } }

.cart-footer {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
  margin-top: 16px;
  background: rgb(16 16 16 / 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 14px;
  box-shadow: 0 10px 36px rgb(0 0 0 / 0.55);
  animation: view-in 0.4s var(--ease-out) both;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.cart-total-label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.cart-total { font-size: 24px; font-weight: 700; letter-spacing: 0; font-family: var(--font-num); }

/* ---------- buttons ---------- */
.btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-m);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 0.15s var(--ease-out), opacity 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; pointer-events: none; }
.btn-primary {
  background: var(--invert-bg);
  color: var(--invert-text);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgb(0 0 0 / 0.1), transparent);
  transform: skewX(-18deg);
  animation: btn-shine 3.2s var(--ease-out) infinite;
}
@keyframes btn-shine {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 10px 14px; font-size: 13px; width: auto; border-radius: var(--radius-s); }

/* ---------- inline card brand logos ---------- */
.brand-ico {
  display: inline-block;
  width: auto;
  vertical-align: middle;
  margin: 0 0.15em;
  position: relative;
  top: -0.08em;
  object-fit: contain;
}
.brand-mc { height: 1.35em; }
.brand-visa { height: 0.95em; }

/* ---------- swipe to confirm (fixed bottom bar) ---------- */
.swipe-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.swipe-overlay.show { opacity: 1; }
.swipe-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-1, #0d0d0d);
  border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-spring);
}
.swipe-overlay.show .swipe-panel { transform: translateY(0); }
.swipe-grabber {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  margin: 0 auto 16px;
}
.swipe-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}
.swipe-summary-left { display: flex; flex-direction: column; gap: 2px; }
.swipe-summary-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.swipe-summary-items { font-size: 13px; color: var(--text-dim); }
.swipe-summary-total {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}
.swipe-cancel {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 14px 0 2px;
  cursor: pointer;
  text-align: center;
}
.swipe-confirm {
  position: relative;
  height: 60px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.swipe-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--invert-bg));
  opacity: 0.18;
  border-radius: var(--radius-full);
}
.swipe-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}
.swipe-chevrons { display: inline-flex; align-items: center; }
.swipe-chevrons svg { margin-left: -7px; animation: chevron-run 1.4s ease-in-out infinite; }
.swipe-chevrons svg:nth-child(1) { animation-delay: 0s; }
.swipe-chevrons svg:nth-child(2) { animation-delay: 0.18s; }
.swipe-chevrons svg:nth-child(3) { animation-delay: 0.36s; }
@keyframes chevron-run {
  0%, 60%, 100% { opacity: 0.15; }
  30% { opacity: 1; }
}
.swipe-knob {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  background: var(--invert-bg);
  color: var(--invert-text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(255 255 255 / 0.06);
  z-index: 2;
  cursor: grab;
}
.swipe-knob:active { cursor: grabbing; }
.swipe-confirm.busy .swipe-label { opacity: 0.6; }

/* ---------- screenshot attach ---------- */
.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.attach-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.attach-btn.has-file { border-style: solid; }
.attach-name {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 45%;
}
.attach-preview {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  background: var(--surface-2);
}

/* ---------- admin: top-up requests ---------- */
.req-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px;
  margin-bottom: 10px;
}
.req-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.req-user { font-weight: 700; font-size: 14px; }
.req-amount { font-size: 15px; font-weight: 700; }
.req-meta { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.req-shot {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: #000;
  margin-bottom: 10px;
}
.req-actions { display: flex; gap: 8px; }
.req-actions .btn { flex: 1; }

/* ---------- success overlay ---------- */
.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgb(5 5 5 / 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.success-overlay.show { opacity: 1; pointer-events: auto; }
.success-circle {
  width: 92px; height: 92px;
  border-radius: var(--radius-full);
  background: var(--invert-bg);
  color: var(--invert-text);
  display: flex; align-items: center; justify-content: center;
  transform: scale(0);
}
.success-overlay.show .success-circle { animation: pop-in 0.55s var(--ease-spring) forwards; }
@keyframes pop-in {
  0% { transform: scale(0) rotate(-30deg); }
  70% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.success-check { stroke-dasharray: 40; stroke-dashoffset: 40; }
.success-overlay.show .success-check { animation: draw-check 0.45s 0.25s var(--ease-out) forwards; }
@keyframes draw-check { to { stroke-dashoffset: 0; } }
.success-title { font-size: 19px; font-weight: 800; }
.success-sub { color: var(--text-dim); font-size: 13px; text-align: center; max-width: 260px; }

/* ---------- purchases ---------- */
.purchase-list { display: flex; flex-direction: column; gap: 10px; }
.purchase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  animation: card-in 0.4s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.purchase-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  text-align: left;
}
.purchase-check {
  width: 34px; height: 34px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.purchase-meta { flex: 1; min-width: 0; }
.purchase-name { font-weight: 700; font-size: 14px; }
.purchase-date { color: var(--text-dim); font-size: 12px; }
.purchase-price { font-weight: 700; font-size: 14px; font-family: var(--font-num); }
.purchase-chevron { color: var(--text-faint); transition: transform 0.25s var(--ease-out); display: flex; }
.purchase-card.open .purchase-chevron { transform: rotate(180deg); }

.purchase-data {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s var(--ease-out);
}
.purchase-card.open .purchase-data { max-height: 340px; }
.purchase-data-inner {
  margin: 0 14px 14px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-s);
  padding: 12px;
  position: relative;
}
.purchase-data code {
  display: block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 190px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.purchase-data code::-webkit-scrollbar { width: 4px; }
.purchase-data code::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}
.copy-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.15s, color 0.15s, border-color 0.15s;
}
.copy-btn:active { transform: scale(0.88); }
.copy-btn.copied { color: var(--text); border-color: var(--border-strong); }

/* ---------- profile ---------- */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  animation: view-in 0.4s var(--ease-out) both;
}
.profile-card::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 190px; height: 190px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle, rgb(255 255 255 / 0.055), transparent 70%);
  pointer-events: none;
}
.profile-top { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 60px; height: 60px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: var(--text-dim);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
.profile-id-block { min-width: 0; }
.profile-name { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.profile-username { color: var(--text-dim); font-size: 13px; }
.profile-tgid { color: var(--text-faint); font-size: 11px; margin-top: 1px; font-family: "JetBrains Mono", ui-monospace, monospace; }

.balance-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.balance-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.balance-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0;
  font-family: var(--font-num);
  color: var(--text);
  transition: transform 0.3s var(--ease-spring);
}
.balance-value.bump { animation: balance-bump 0.5s var(--ease-spring); }
@keyframes balance-bump {
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.profile-actions { display: flex; flex-direction: column; gap: 8px; }
.action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  width: 100%;
  transition: transform 0.15s var(--ease-out), border-color 0.2s;
  animation: card-in 0.4s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.action-btn:active { transform: scale(0.975); border-color: var(--border-strong); }
.action-btn:active .chev { transform: translateX(4px); }
.action-btn .chev { transition: transform 0.25s var(--ease-spring); }
.action-btn:active .action-icon { transform: scale(1.12) rotate(-4deg); }
.action-btn .action-icon { transition: transform 0.25s var(--ease-spring); }
.action-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.action-btn .chev { margin-left: auto; color: var(--text-faint); display: flex; }
.action-btn.admin-entry { border-style: dashed; border-color: var(--border-strong); }

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}
.sheet-backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 105%);
  bottom: 0;
  width: min(100%, 560px);
  max-height: 86dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  transition: transform 0.38s var(--ease-spring);
  padding-bottom: calc(var(--safe-bottom) + 16px);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet.open .sheet-body > * { animation: view-in 0.4s var(--ease-out) both; }
.sheet.open .sheet-body > :nth-child(1) { animation-delay: 60ms; }
.sheet.open .sheet-body > :nth-child(2) { animation-delay: 110ms; }
.sheet.open .sheet-body > :nth-child(3) { animation-delay: 160ms; }
.sheet.open .sheet-body > :nth-child(4) { animation-delay: 210ms; }
.sheet.open .sheet-body > :nth-child(n + 5) { animation-delay: 260ms; }
.sheet-grab {
  width: 40px; height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  margin: 10px auto 4px;
  flex-shrink: 0;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 12px;
  flex-shrink: 0;
}
.sheet-title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.sheet-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: transform 0.15s;
}
.sheet-close:active { transform: scale(0.85); }
.sheet-body { overflow-y: auto; padding: 0 18px 8px; flex: 1; }

/* product detail in sheet */
.detail-img {
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
}
.detail-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  animation: kenburns 14s var(--ease-out) both;
}
@keyframes kenburns {
  from { transform: scale(1.12) translateY(-2%); }
  to { transform: scale(1) translateY(0); }
}
.detail-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.detail-desc { font-family: var(--font-display); font-weight: 300; color: var(--text-dim); font-size: 11.5px; line-height: 1.6; margin: 6px 0 14px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.detail-price { font-size: 26px; font-weight: 700; font-family: var(--font-num); }
.detail-stock { color: var(--text-dim); font-size: 12px; font-weight: 600; }

/* topup methods */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.method-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 16px 10px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}
.method-btn:active { transform: scale(0.96); }
.method-btn.selected { border-color: var(--invert-bg); background: var(--surface-3); }
.method-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
}
.method-icon img { width: 100%; height: 100%; object-fit: cover; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--border-strong); }
.field .hint { color: var(--text-faint); font-size: 11px; margin-top: 5px; }
.field-hint { color: var(--text-faint); font-size: 11px; line-height: 1.45; margin-top: 6px; }

.btn-del {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-s);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-faint);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn-del:active { transform: scale(0.88); }
.btn-del:hover { color: #ff8ea1; border-color: rgb(255 142 161 / 0.4); }
.btn-del:disabled { opacity: 0.4; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .card-img img, .detail-img img { animation: none; }
  #app.sheet-behind { transform: none; }
}

.amount-input { position: relative; }
.amount-input input {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-num);
  padding: 14px 40px 14px 16px;
  text-align: center;
}
.amount-input .cur {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 18px;
  font-weight: 700;
}
.quick-amounts { display: flex; gap: 8px; margin: 10px 0 14px; }
.quick-amounts button {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.quick-amounts button:active { transform: scale(0.94); }
.quick-amounts button.sel { background: var(--invert-bg); color: var(--invert-text); border-color: var(--invert-bg); }

/* wallet rows */
.wallet-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  margin-bottom: 10px;
  animation: card-in 0.35s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.wallet-label { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--text-faint); text-transform: uppercase; }
.wallet-addr-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.wallet-addr {
  flex: 1;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
}
.wallet-copy {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--radius-s);
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: transform 0.15s, color 0.15s;
}
.wallet-copy:active { transform: scale(0.88); }
.wallet-copy.copied { color: var(--text); }

/* history rows in sheets */
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  animation: card-in 0.32s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.hist-row:last-child { border-bottom: none; }
.hist-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text-dim);
}
.hist-icon img { width: 100%; height: 100%; object-fit: cover; }
.hist-main { flex: 1; min-width: 0; }
.hist-title { font-weight: 700; font-size: 14px; }
.hist-sub { color: var(--text-dim); font-size: 12px; }
.hist-amount { font-weight: 700; font-size: 15px; font-family: var(--font-num); }
.hist-amount.neg { color: var(--text-dim); }
.hist-status {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.hist-status.completed { color: var(--invert-text); background: var(--invert-bg); border-color: var(--invert-bg); }
.hist-status.failed { color: var(--danger); border-color: var(--danger); }

/* ---------- admin ---------- */
.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}
.admin-tab.active { background: var(--invert-bg); color: var(--invert-text); border-color: var(--invert-bg); }

.admin-product-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 10px 12px;
  margin-bottom: 8px;
  animation: card-in 0.32s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.admin-product-row.hidden-item { opacity: 0.55; }
.ap-main { flex: 1; min-width: 0; }
.ap-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-meta { color: var(--text-dim); font-size: 11px; }
.toggle {
  position: relative;
  width: 42px; height: 24px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  transition: background 0.25s;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: var(--radius-full);
  background: var(--text-dim);
  transition: transform 0.25s var(--ease-spring), background 0.25s;
}
.toggle.on { background: var(--invert-bg); }
.toggle.on::after { transform: translateX(18px); background: var(--invert-text); }

.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.step-dot {
  width: 7px; height: 7px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  transition: background 0.25s, transform 0.25s var(--ease-spring);
}
.step-dot.active { background: var(--invert-bg); transform: scale(1.35); }
.step-dot.done { background: var(--text-faint); }

.broadcast-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  word-break: break-word;
}
.broadcast-preview img { border-radius: var(--radius-s); margin-bottom: 8px; }
.broadcast-preview .bp-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.broadcast-stats { display: flex; gap: 8px; margin-top: 12px; }
.bstat {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 10px;
  text-align: center;
}
.bstat .n { font-size: 21px; font-weight: 700; font-family: var(--font-num); }
.bstat .l { font-size: 10px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.found-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  padding: 10px 12px;
  margin-bottom: 12px;
  animation: card-in 0.3s var(--ease-out) both;
}
.seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 3px;
  margin-bottom: 12px;
}
.seg button {
  flex: 1;
  padding: 9px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}
.seg button.sel { background: var(--invert-bg); color: var(--invert-text); }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100% - 32px), 400px);
  pointer-events: none;
}
.toast {
  background: var(--invert-bg);
  color: var(--invert-text);
  border-radius: var(--radius-m);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.5);
  animation: toast-in 0.4s var(--ease-spring) both;
}
.toast.err { background: #1c1c1c; color: var(--danger); border: 1px solid var(--danger); }
.toast.hide { animation: toast-out 0.3s var(--ease-out) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-18px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-14px) scale(0.95); }
}

/* fly-to-cart dot */
.fly-dot {
  position: fixed;
  width: 14px; height: 14px;
  border-radius: var(--radius-full);
  background: var(--invert-bg);
  z-index: 400;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
