/* ==========================================================================
   Rat Store — Telegram Mini App storefront
   Palette: blue + green + red with a full-screen photo and dark/light themes.
   ========================================================================== */

/* ---------------- Theme tokens ---------------- */
:root {
  --blue: #2f6bff;
  --blue-2: #1d4ed8;
  --blue-soft: rgba(47, 107, 255, 0.16);
  --green: #1fc16b;
  --green-2: #16a34a;
  --green-soft: rgba(31, 193, 107, 0.16);
  --red: #ef4444;
  --red-2: #dc2626;
  --red-soft: rgba(239, 68, 68, 0.16);
  --yellow: #f59e0b;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --tabbar-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  /* Latin stack. "Inter" is loaded from Google Fonts in index.html. */
  --font-latin: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  /* Khmer stack: webfonts first, then the native Khmer faces shipped by
     iOS/macOS/Windows/Android, then the Latin stack. System Khmer coverage is
     inconsistent across Android WebViews, which is why the webfonts lead. */
  --font-khmer: "Bayon", "Kantumruy Pro", "Noto Sans Khmer", "Khmer OS Battambang",
    "Khmer OS", "Hanuman", "Leelawadee UI", "Nirmala UI", var(--font-latin);
}
html[data-theme="dark"] {
  --bg: #05070d;
  --bg-2: #0a0e17;
  --surface: #0d1119;
  --surface-2: #141a26;
  --surface-3: #1b2331;
  --border: #202a3a;
  --border-soft: #172030;
  --text: #eaf0f9;
  --text-2: #c4cfdf;
  --muted: #8a97ab;
  --bg-scrim: rgba(5, 7, 13, 0.14);
  --chrome-bg: rgba(5, 7, 13, 0.72);
  --glow: rgba(47, 107, 255, 0.35);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] {
  --bg: #eef1f8;
  --bg-2: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --surface-3: #e6ebf5;
  --border: #dfe5f0;
  --border-soft: #e9edf6;
  --text: #0e1626;
  --text-2: #38445a;
  --muted: #61708a;
  --bg-scrim: rgba(238, 241, 248, 0.58);
  --chrome-bg: rgba(238, 241, 248, 0.76);
  --glow: rgba(47, 107, 255, 0.25);
  --shadow: 0 18px 40px rgba(30, 50, 90, 0.14);
}

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

html, body {
  margin: 0; padding: 0; min-height: 100%;
  color: var(--text);
  font-family: var(--font-latin);
  -webkit-font-smoothing: antialiased;
  transition: background .4s var(--ease), color .4s var(--ease);
  /* Reserve the scrollbar lane so locking scroll for a modal never shifts the page. */
  scrollbar-gutter: stable;
  /* Anti-inspect / anti-copy hardening: page text cannot be selected or
     long-pressed. Form controls stay selectable so editing still works. */
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Keep the page background transparent so the fixed photo remains visible.
   Isolate the body stacking context so its negative-z backdrop stays above
   the html fallback color and behind all app content. */
html { background: var(--bg); }
body { position: relative; isolation: isolate; background: transparent; }

input, textarea, select, [contenteditable="true"],
.detail-desc, .detail-desc *, .accounts, .account-line, .code-box,
[data-selectable], [data-selectable] * {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* Remove the ~300ms tap delay and accidental double-tap zoom on interactive UI. */
button, .tab, .btn { touch-action: manipulation; }
.hidden { display: none !important; }
img { -webkit-user-drag: none; }
.muted { color: var(--muted); }

/* Form controls do not inherit the page font by default. */
button, input, select, textarea { font-family: inherit; }

/* ---------------- Khmer (ខ្មែរ) typography ----------------
   Activated automatically by the language switch, which sets <html lang="km">.
   Khmer needs taller line boxes for its ascenders/diacritics, and it must NOT
   receive Latin letter-spacing or `text-transform: uppercase` — both visibly
   break Khmer clusters. Kept after the Latin base rules so it always wins. */
html[lang="km"] body,
html[lang="km"] button,
html[lang="km"] input,
html[lang="km"] select,
html[lang="km"] textarea {
  font-family: var(--font-khmer);
}
html[lang="km"] body { line-height: 1.7; }
.bayon-regular {
  font-family: "Bayon", sans-serif;
  font-weight: 400;
  font-style: normal;
}

/* Latin-only content (IDs, prices, codes) keeps the Latin metrics. */
html[lang="km"] code,
html[lang="km"] .mono,
html[lang="km"] .chip-value,
html[lang="km"] .balance-card .value,
html[lang="km"] .timer { font-family: var(--font-latin); }

/* The ABA PayWay card is brand artwork — keep its Latin faces even in Khmer. */
html[lang="km"] .payway-wordmark,
html[lang="km"] .payway-bank,
html[lang="km"] .payway-amount strong,
html[lang="km"] .payway-amount span { font-family: var(--font-latin); }

html[lang="km"] .btn,
html[lang="km"] .tab,
html[lang="km"] .lang-btn,
html[lang="km"] .brand-name,
html[lang="km"] .brand-sub,
html[lang="km"] .product-name,
html[lang="km"] .product-meta,
html[lang="km"] .stock-mini,
html[lang="km"] .list-title,
html[lang="km"] .list-sub,
html[lang="km"] .list-amount,
html[lang="km"] .banner-overlay h1,
html[lang="km"] .banner-overlay p,
html[lang="km"] .section-title h2,
html[lang="km"] .section-title .count,
html[lang="km"] .detail-name,
html[lang="km"] .detail-row,
html[lang="km"] .modal-head h3,
html[lang="km"] .account-line,
html[lang="km"] .payway-hint,
html[lang="km"] .empty,
html[lang="km"] .toast { letter-spacing: 0; }

/* Uppercase + wide tracking is a Latin convention that corrupts Khmer. */
html[lang="km"] .balance-card .label,
html[lang="km"] .balance-chip .chip-label,
html[lang="km"] .payway-label { text-transform: none; letter-spacing: 0; }
/* Slightly larger labels — Khmer glyphs are denser than Latin at the same size. */
html[lang="km"] .balance-card .label { font-size: 13px; }
html[lang="km"] .balance-chip .chip-label { font-size: 10px; }

/* Taller line boxes so Khmer diacritics are never clipped. */
html[lang="km"] .btn { font-size: 13.5px; line-height: 1.5; }
html[lang="km"] .tab { font-size: 11px; line-height: 1.35; }
html[lang="km"] .product-name { line-height: 1.6; }
html[lang="km"] .banner-overlay p,
html[lang="km"] .section-title h2,
html[lang="km"] .detail-row,
html[lang="km"] .list-sub { line-height: 1.5; }
html[lang="km"] .brand-sub { line-height: 1.4; }

/* ---------------- Full-screen photo backdrop ---------------- */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background-image: linear-gradient(var(--bg-scrim), var(--bg-scrim)), url("background.jpg");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* ---------------- Boot / fatal ---------------- */
.boot, .fatal { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; }
.boot-logo { position: relative; width: 74px; height: 74px; display: grid; place-items: center; }
.boot-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--blue); border-right-color: var(--green);
  animation: spin 1s linear infinite;
}
.boot-emoji { font-size: 30px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.fatal-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px 24px; box-shadow: var(--shadow);
  animation: popIn .45s var(--ease) both;
}
.fatal-ico { font-size: 42px; margin-bottom: 8px; }
.fatal-card h2 { margin: 0 0 8px; font-size: 19px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Shell ---------------- */
.app { min-height: 100vh; min-height: 100svh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 6px); }

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--chrome-bg);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  border-bottom: 1px solid var(--border-soft);
}
.app-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--green), var(--red), transparent);
  background-size: 200% 100%;
  animation: gradientShift 8s linear infinite; opacity: .7;
}
@keyframes gradientShift { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.logo-mark {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px; overflow: hidden;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 0 0 4px var(--blue-soft), 0 8px 20px var(--glow);
  transition: transform .4s var(--ease);
}
.logo-mark:active { transform: scale(.93) rotate(-6deg); }
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }
.logo-svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.boot-svg { width: 34px; height: 34px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: bob 1.6s ease-in-out infinite; }
.profile-avatar { margin: 0 auto 10px; width: 66px; height: 66px; font-size: 28px; border-radius: 22px; }
.profile-avatar img { border-radius: 22px; }
.card.profile-hero { position: relative; isolation: isolate; overflow: hidden; text-align: center; padding: 26px 16px 22px; }
.profile-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("profile-pattern.svg") repeat center top / 138px 130px;
  opacity: .46;
}
html[data-theme="dark"] .profile-hero::before { filter: invert(1); opacity: .25; }
.profile-hero > * { position: relative; z-index: 1; }
.profile-identity {
  display: inline-block; max-width: 100%; padding: 8px 18px;
  border: 1px solid var(--border-soft); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.profile-identity h2 { margin: 0 0 2px; font-size: 19px; overflow-wrap: anywhere; }
.profile-identity p { margin: 0; overflow-wrap: anywhere; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: transform .2s var(--ease), background .2s, border-color .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.lang-btn { width: auto; min-width: 44px; padding: 0 10px; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.lang-btn .lang-label { line-height: 1; }
.lang-icon-slot { display: none; place-items: center; }
.lang-btn.has-icon .lang-icon-slot { display: grid; }
.lang-btn.has-icon .lang-label { display: none; }
.lang-icon-img { width: 20px; height: 20px; object-fit: contain; }
.lang-icon-emoji { font-size: 18px; line-height: 1; }
.th-sun { display: none; }
html[data-theme="light"] .th-sun { display: block; }
html[data-theme="light"] .th-moon { display: none; }
#theme-toggle { overflow: hidden; }
#theme-toggle svg { transition: transform .5s var(--ease), opacity .3s; }

.balance-chip {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 55%, #15803d 100%);
  border: 1px solid rgba(31, 193, 107, .55);
  border-radius: 13px; padding: 7px 13px; cursor: pointer; color: #fff;
  box-shadow: 0 8px 20px -6px var(--green), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .2s var(--ease), box-shadow .2s, filter .2s;
}
.balance-chip::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 95% at 88% 8%, rgba(255, 255, 255, .38), transparent 55%);
}
.balance-chip::after {
  content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%;
  right: -34px; top: -46px; background: rgba(255, 255, 255, .18); filter: blur(10px);
}
.balance-chip:active { transform: scale(.95); filter: brightness(1.05); box-shadow: 0 6px 16px -6px var(--green); }
.balance-chip .chip-label { position: relative; z-index: 1; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .85); }
.balance-chip .chip-value { position: relative; z-index: 1; font-size: 15px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .22); }

.views { padding: 16px 14px 24px; max-width: 1180px; margin: 0 auto; }
.view { animation: viewIn .42s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------------- Banner / hero ---------------- */
.banner {
  position: relative; width: 100%; min-height: 168px; overflow: hidden;
  border-radius: var(--radius-lg); margin-bottom: 18px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: flex-end;
  background: linear-gradient(130deg, var(--blue), var(--green-2) 55%, var(--blue-2));
}
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.banner-overlay {
  position: relative; z-index: 1; width: 100%; padding: 18px;
  background: linear-gradient(180deg, transparent 10%, rgba(3, 6, 12, .82));
  display: flex; flex-direction: column; gap: 10px;
}
.banner-overlay h1 { margin: 0; font-size: 21px; font-weight: 850; color: #fff; letter-spacing: .2px; }
.banner-overlay p { margin: 0; font-size: 12.5px; color: #d7e2f2; }
.banner-actions { display: flex; gap: 8px; margin-top: 2px; }
.banner .btn-sm { backdrop-filter: blur(6px); }

/* Floating sparkles on hero */
.banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.8), transparent),
    radial-gradient(2px 2px at 70% 20%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.5px 1.5px at 45% 70%, rgba(255,255,255,.7), transparent),
    radial-gradient(2px 2px at 85% 65%, rgba(255,255,255,.5), transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .25; } to { opacity: .8; } }

/* ---------------- Section titles ---------------- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 12px; }
.section-title h2 { margin: 0; font-size: 16.5px; font-weight: 750; }
.section-title .count { color: var(--muted); font-size: 12.5px; }

/* Small admin-configurable payment icons in the Wallet "Add balance" heading. */
.pay-icons { display: inline-flex; align-items: center; gap: 6px; }
.pay-ico { width: 18px; height: 18px; object-fit: contain; display: block; }
.pay-ico-emoji { font-size: 16px; line-height: 1; }

/* ---------------- Product grid ---------------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }

/* Premium Telegram emoji rendered as sticker images */
.tg-emoji {
  width: 1.15em; height: 1.15em; object-fit: contain;
  vertical-align: -0.22em; display: inline-block;
}
.tg-emoji-lg { width: 58%; height: 58%; object-fit: contain; }

.product-card {
  position: relative; overflow: hidden; contain: content;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; display: flex; flex-direction: column;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .14);
  animation: fadeUp .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.product-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--blue) 55%, var(--border)); box-shadow: 0 16px 34px rgba(0, 0, 0, .24); }
.product-card:active { transform: scale(.975); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.product-thumb {
  position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  display: grid; place-items: center; font-size: 46px;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.product-card:hover .product-thumb img { transform: scale(1.08); }
.product-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.22)); opacity: 0; transition: opacity .3s; }
.product-card:hover .product-thumb::after { opacity: 1; }

.badge { position: absolute; top: 8px; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; backdrop-filter: blur(6px); }
.badge.in { right: 8px; left: auto; background: var(--green-soft); color: #4fd68c; border: 1px solid rgba(31, 193, 107, .45); }
.badge.out { right: 8px; left: auto; background: var(--red-soft); color: #ff9a9a; border: 1px solid rgba(239, 68, 68, .45); }
.badge.api { position: static; display: inline-block; margin: 0 0 4px; background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(47, 107, 255, .4); }

.product-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.product-name { font-size: 13.5px; font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.price { font-size: 15px; font-weight: 800; color: var(--green); }
.stock-mini { font-size: 11px; color: var(--muted); }

/* Skeleton */
.skeleton { border-radius: var(--radius); overflow: hidden; }
.sk-thumb { aspect-ratio: 1/1; background: var(--surface-3); }
.sk-line { height: 11px; margin: 9px 12px; border-radius: 6px; background: var(--surface-3); }
.sk-line.short { width: 55%; }
.sk-thumb, .sk-line { position: relative; overflow: hidden; }
.sk-thumb::after, .sk-line::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------------- Buttons ---------------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14.5px; font-weight: 750;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: transform .12s var(--ease), background .2s, box-shadow .2s, border-color .2s;
}
.btn:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-2)); border-color: transparent; color: #fff; box-shadow: 0 10px 24px var(--glow); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-success { background: linear-gradient(135deg, var(--green), var(--green-2)); border-color: transparent; color: #04160c; box-shadow: 0 10px 24px var(--green-soft); }
.btn-danger { background: linear-gradient(135deg, var(--red), var(--red-2)); border-color: transparent; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn .ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.45); animation: ripple .6s var(--ease); pointer-events: none; }
@keyframes ripple { to { transform: scale(3); opacity: 0; } }

/* ---------------- Product detail ---------------- */
.detail-hero {
  position: relative; width: 100%; aspect-ratio: 16 / 12; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  display: grid; place-items: center; font-size: 76px;
  animation: popIn .4s var(--ease) both;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-name { font-size: 21px; font-weight: 850; margin: 0 0 6px; }
.detail-price { font-size: 24px; font-weight: 850; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--green), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.detail-read-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; padding: 11px 12px 11px 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 55%, var(--border)); border-radius: var(--radius-sm);
  background: linear-gradient(110deg, var(--blue-soft), var(--surface-2));
  color: var(--text); font: inherit; font-size: 13px; font-weight: 750; line-height: 1.4;
  text-align: left; cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.detail-read-btn:hover { border-color: var(--blue); }
.detail-read-btn:active { transform: scale(.98); }
.detail-read-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.detail-read-arrow {
  width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center;
  border-radius: 9px; background: var(--blue); color: #fff; font-size: 18px; line-height: 1;
}
.detail-desc {
  color: var(--text-2); font-size: 14px; line-height: 1.65; white-space: pre-wrap;
  cursor: text;
  overflow-wrap: anywhere; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 13px 14px; margin-bottom: 16px;
}
.detail-desc:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.detail-row:last-of-type { border-bottom: 0; }
.detail-row .k { color: var(--muted); }

.qty { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.qty button { width: 44px; height: 44px; background: transparent; border: 0; color: var(--text); font-size: 22px; font-weight: 700; cursor: pointer; transition: background .2s; }
.qty button:active { background: var(--blue-soft); }
.qty button:disabled { opacity: .35; }
.qty input { width: 56px; height: 44px; text-align: center; background: transparent; border: 0; color: var(--text); font-size: 16px; font-weight: 800; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------- Cards / list ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 8px 22px rgba(0,0,0,.1); }
.balance-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 26%, var(--surface)), color-mix(in srgb, var(--green) 18%, var(--surface)));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 4px; animation: fadeUp .5s var(--ease) both;
}
.balance-card::before {
  content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%;
  top: -70px; right: -50px; background: var(--blue); opacity: .25; filter: blur(24px);
  animation: float3 8s var(--ease) infinite alternate;
}
.balance-card .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.balance-card .value { font-size: 36px; font-weight: 850; color: var(--green); letter-spacing: -.5px; }

.deposit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.deposit-amt {
  padding: 15px 0; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 15px; font-weight: 800; cursor: pointer;
  transition: transform .18s var(--ease), border-color .2s, background .2s, box-shadow .2s;
}
.deposit-amt:hover { transform: translateY(-2px); border-color: var(--blue); }
.deposit-amt:active { transform: scale(.95); background: var(--blue-soft); }
.deposit-amt.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 8px 18px var(--glow); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 13px; font: inherit; font-size: 15px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }

.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 10px; cursor: pointer;
  animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform .18s var(--ease), border-color .2s;
}
.list-item:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); }
.list-item:active { border-color: var(--blue); }
.list-thumb { width: 50px; height: 50px; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-body { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); margin-top: 3px; }
.list-count { white-space: nowrap; }
.order-date {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 999px; color: var(--green); font-weight: 700; font-size: 11px;
  background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 38%, transparent);
  font-variant-numeric: tabular-nums; letter-spacing: .2px;
  box-shadow: 0 4px 14px -8px var(--green);
  animation: fadeUp .4s var(--ease) both;
}
.order-date-ico { width: 12px; height: 12px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.detail-row .order-date { font-size: 12px; }
.list-amount { font-size: 14px; font-weight: 800; color: var(--green); white-space: nowrap; }

.accounts { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-top: 12px; }
.account-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.account-line:last-child { border-bottom: 0; }
.account-line code { font-family: ui-monospace, Consolas, monospace; word-break: break-all; color: var(--text-2); flex: 1; }

/* ---------------- Profile buying guides ---------------- */
.profile-guide-btn { margin-bottom: 10px; justify-content: space-between; border-color: var(--blue); }
.guide-intro { margin: 0 0 16px; font-size: 13px; line-height: 1.6; }
.guide-list { display: grid; gap: 12px; }
.guide-card {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.guide-card:hover, .guide-card:focus-visible { border-color: var(--blue); }
.guide-thumb { width: 72px; height: 72px; flex: 0 0 72px; display: grid; place-items: center; border-radius: 12px; overflow: hidden; background: var(--surface-3); font-size: 30px; }
.guide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.guide-card-body { min-width: 0; flex: 1; display: grid; gap: 6px; }
.guide-card-body strong { font-size: 14px; overflow-wrap: anywhere; }
.guide-card-body > .muted { font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.guide-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.guide-tags span { border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 10px; padding: 3px 6px; }
.guide-chevron { color: var(--blue); font-size: 24px; }
.buying-guide h4 { margin: 18px 0 10px; font-size: 14px; }
.guide-cover { display: block; width: 100%; max-height: 300px; object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-2); }
.guide-text { font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.guide-video { display: block; width: 100%; max-height: 350px; border-radius: var(--radius-sm); background: #090c14; }
.youtube-logo { display: block; width: 28px; height: 20px; flex: 0 0 28px; }
.guide-youtube { margin-top: 16px; gap: 10px; text-decoration: none; border-color: rgba(255, 0, 0, .3); background: var(--surface-2); }
.guide-youtube:hover { background: var(--red-soft); border-color: #ff0000; }
.guides-modal .modal-foot { flex-wrap: wrap; }
.guides-modal .modal-foot .btn { flex: 1 1 160px; }

/* ---------------- Bottom tab bar ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch; overflow: hidden;
  background: var(--chrome-bg);
  backdrop-filter: blur(10px) saturate(130%);
  -webkit-backdrop-filter: blur(10px) saturate(130%);
  border-top: 1px solid var(--border);
}
.tab-indicator {
  position: absolute; top: 0; left: 0; height: 3px; width: 34px; border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  box-shadow: 0 0 12px var(--glow);
  will-change: transform;
  transition: transform .35s var(--ease);
}
.tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 10.5px; font-weight: 650; cursor: pointer;
  transition: color .25s;
}
.tab-ico-slot { display: grid; place-items: center; height: 22px; min-width: 22px; }
.tab-icon-img { width: 22px; height: 22px; object-fit: contain; transition: transform .3s var(--ease); }
.tab-icon-emoji { font-size: 19px; line-height: 1; }
.tab-ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.tab.active { color: var(--blue); }
.tab.active .tab-ico { stroke: var(--blue); transform: translateY(-2px) scale(1.08); filter: drop-shadow(0 0 8px var(--glow)); }
.tab.active .tab-icon-img { transform: translateY(-2px) scale(1.08); filter: drop-shadow(0 0 8px var(--glow)); }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(2, 4, 8, .62);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  backdrop-filter: blur(4px); animation: backdropIn .25s var(--ease);
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 560px) { .modal-backdrop { align-items: center; padding: 20px; } }
.modal {
  width: 100%; max-width: 520px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow); animation: sheetUp .35s var(--ease); max-height: 92vh; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
@media (min-width: 560px) { .modal { border-radius: var(--radius); } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 18px; min-width: 0; overflow-x: hidden; }
.modal-foot { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.x-close { background: transparent; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: background .2s, color .2s; }
.x-close:hover { background: var(--surface-2); color: var(--text); }

/* Admin-configured announcement shown after the storefront opens. */
.announcement-backdrop { align-items: center; padding: 20px; }
.announcement-modal {
  width: min(100%, 440px); max-height: calc(100vh - 40px);
  position: relative; border-radius: 22px; isolation: isolate;
  border-color: color-mix(in srgb, var(--blue) 40%, var(--border));
  background-color: var(--surface);
  background-image: radial-gradient(ellipse at 50% 0%, var(--blue-soft), transparent 65%);
  box-shadow: 0 24px 70px rgba(0,0,0,.35), 0 0 35px var(--blue-soft);
  animation: popIn .4s var(--ease);
}
.announcement-modal::after {
  content: ""; position: absolute; left: 18%; right: 18%; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--green), transparent);
  box-shadow: 0 0 16px var(--glow); pointer-events: none;
  animation: announceGlow 4s ease-in-out infinite;
}
@keyframes announceGlow { 0%, 100% { opacity: .6; transform: scaleX(.85); } 50% { opacity: 1; transform: scaleX(1); } }
.announcement-modal .modal-head { border-bottom: 0; background: transparent; }
.announcement-content { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.announcement-content > * { animation: announceRise .5s var(--ease) both; }
.announcement-content > :nth-child(2) { animation-delay: .08s; }
.announcement-content > :nth-child(3) { animation-delay: .16s; }
@keyframes announceRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.announcement-icon {
  width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center;
  flex: 0 0 auto; background: linear-gradient(135deg, var(--blue-soft), var(--green-soft));
  color: var(--text); font-size: 42px; box-shadow: 0 10px 28px var(--blue-soft);
}
.announcement-icon .tg-emoji-lg { width: 56px; height: 56px; object-fit: contain; }
.announcement-text {
  max-width: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: "Inter", "Bayon", "Kantumruy Pro", "Noto Sans Khmer", sans-serif;
  font-size: 15.5px; line-height: 1.85; letter-spacing: normal; text-transform: none;
}
.announcement-text.bayon-regular { font-family: "Bayon", "Kantumruy Pro", sans-serif; font-size: 17px; line-height: 2.05; }
html[lang="km"] .announcement-text { font-family: var(--font-khmer); font-size: 17px; line-height: 2.05; }
.announcement-video-shell {
  width: 100%; padding: 4px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--blue) 38%, var(--border));
  background: var(--surface-2); box-shadow: 0 12px 26px rgba(0,0,0,.18);
}
.announcement-video-shell video {
  display: block; width: 100%; max-height: min(38vh, 300px);
  object-fit: contain; border-radius: 12px; background: #090c14;
}
.announcement-modal .modal-foot .btn { box-shadow: 0 10px 24px var(--glow); }

/* Product buy button — left-to-right slide fill on hover */
.btn-buy-slide { isolation: isolate; }
.btn-buy-slide::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(135deg, var(--blue), var(--green));
  transform: scaleX(0); transform-origin: left center;
  transition: transform .42s var(--ease);
}
.btn-buy-slide:hover::before { transform: scaleX(1); }
.btn-buy-slide:hover { border-color: transparent; }
.btn-buy-label { position: relative; z-index: 1; }

/* QR */
.qr-frame { width: 100%; max-width: 280px; margin: 6px auto 12px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: popIn .4s var(--ease) both; }
.qr-frame img { width: 100%; display: block; }
.timer { text-align: center; font-size: 14px; font-weight: 800; color: var(--yellow); margin-bottom: 8px; letter-spacing: .5px; }

/* Akatsuki-themed ABA/KHQR checkout */
.payway-modal {
  --payway-navy: #191b24;
  --payway-cyan: #ef6a25;
  --payway-red: #a81723;
  background: #090a0f; color: #f8f8fa; border-color: rgba(194,31,45,.42);
}
.payway-modal .modal-head { background: #101118; border-bottom-color: #2e1820; }
.payway-modal .modal-head h3 { color: #f8f8fa; }
.payway-modal .x-close { color: #aeb0bb; }
.payway-modal .x-close:hover { color: #fff; background: #281218; }
.payway-modal .modal-body { padding: 0; }
.payway-checkout {
  position: relative; overflow: hidden; padding: 18px 12px 20px; text-align: center;
  background: radial-gradient(circle at 14% 28%, rgba(188,35,41,.2), transparent 28%), linear-gradient(180deg, #12131b 0%, #07080c 100%);
}
.payway-checkout::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18; background-image: radial-gradient(circle at center, #c3212f 0 2px, transparent 2.5px); background-size: 30px 30px; }
.payway-checkout > * { position: relative; z-index: 1; }
.payway-brand { display: inline-flex; flex-direction: column; align-items: center; margin: 1px auto 18px; }
.payway-wordmark {
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif; font-size: 34px; font-weight: 950;
  font-style: italic; letter-spacing: -3px; line-height: .82; transform: skew(-8deg); white-space: nowrap;
}
.payway-wordmark span { color: #f4f4f6; }
.payway-wordmark b { color: var(--payway-cyan); font: inherit; }
.payway-bank { margin-top: 7px; color: #aeb0bb; font-size: 9px; font-weight: 900; letter-spacing: .34em; padding-left: .34em; }
.payway-label { margin: 0 0 3px; color: #babcc5; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.payway-amount { display: flex; align-items: baseline; justify-content: center; gap: 7px; margin-bottom: 16px; }
.payway-amount strong { color: #fff; font-size: 30px; letter-spacing: -.03em; text-shadow: 0 0 22px rgba(239,106,37,.2); }
.payway-amount span { color: #ff853d; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.shinobi-pay-scene { position: relative; width: min(100%, 430px); aspect-ratio: 1; margin: -8px auto 8px; }
.obito-frame-image { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 18px rgba(0,0,0,.5)); }
.obito-qr-slot {
  position: absolute; z-index: 2; left: 52.3%; top: 34.4%; width: 40.5%; aspect-ratio: 1;
  display: grid; place-items: center; padding: clamp(4px, 1.5vw, 8px); overflow: hidden;
  background: #fff; border-radius: 3%; box-shadow: 0 5px 18px rgba(0,0,0,.1);
}
.obito-qr-slot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.obito-waiting { width: min(100%, 350px); margin: 0 auto 11px; overflow: hidden; border: 1px solid #3a1a21; border-radius: 14px; background: linear-gradient(180deg, #151721, #090a0f); box-shadow: inset 0 1px rgba(255,255,255,.035); }
.obito-runway { position: relative; display: grid; place-items: center; height: 160px; overflow: hidden; border-bottom: 1px solid #31171d; background: radial-gradient(ellipse at 50% 100%, rgba(156,25,35,.25), transparent 60%); }
.obito-runway::after { content: ""; position: absolute; left: 0; right: 0; bottom: 12px; height: 2px; background: linear-gradient(90deg, transparent, #7e1a24 20%, #7e1a24 80%, transparent); box-shadow: 0 5px 12px rgba(196,31,45,.3); }
.obito-run-gif { position: relative; z-index: 1; display: block; height: 158px; width: auto; object-fit: contain; filter: drop-shadow(0 8px 6px rgba(0,0,0,.7)); }
.payway-status {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px;
  width: 100%; margin: 0; padding: 8px 12px; color: #d6d7dd;
  background: #11131a; border: 0; border-radius: 0; font-size: 11.5px; font-weight: 700;
}
.payway-status-dot { position: relative; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #e9303d; }
.payway-status-dot::after { content: ""; position: absolute; inset: -4px; border: 1px solid #e9303d; border-radius: inherit; animation: paywayPulse 1.5s ease-out infinite; }
@keyframes paywayPulse { from { transform: scale(.5); opacity: .8; } to { transform: scale(1.55); opacity: 0; } }
.payway-status .timer { margin: 0 0 0 auto; color: #ff8a43; font-size: 12px; font-variant-numeric: tabular-nums; }
.payway-hint { max-width: 350px; margin: 0 auto; color: #a7a9b3; font-size: 11.5px; line-height: 1.45; }
.payway-secure { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 13px; color: #7f828d; font-size: 10px; }
.payway-secure svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.payway-modal .modal-foot { flex-direction: column; gap: 8px; background: #101118; border-top: 1px solid #2e1820; }
.payway-modal .modal-foot .btn { min-height: 46px; text-decoration: none; }
.payway-close { min-height: 38px !important; padding-block: 8px; color: #92949e; border-color: transparent; background: transparent; }

@media (max-height: 680px) {
  .payway-checkout { padding-block: 13px; }
  .payway-brand { margin-bottom: 12px; }
  .payway-wordmark { font-size: 29px; }
  .shinobi-pay-scene { width: min(100%, 360px); }
  .payway-secure { display: none; }
}
@media (max-width: 390px) {
  .shinobi-pay-scene { width: min(100%, 350px); }
  .obito-qr-slot { padding: 4px; }
}

/* Success check */
.success-pop { width: 76px; height: 76px; margin: 0 auto 6px; border-radius: 50%;
  background: var(--green-soft); display: grid; place-items: center; font-size: 40px;
  animation: successPop .5s var(--ease) both; }
@keyframes successPop { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.12) rotate(4deg); } 100% { transform: scale(1) rotate(0); } }

/* ---------------- Toast ---------------- */
#toast-root { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 440px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); font-size: 13.5px;
  animation: toastIn .32s var(--ease) both;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
@keyframes toastIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 52px 16px; animation: fadeUp .5s var(--ease) both; }
.empty .big { font-size: 44px; margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }

/* ---------------- Large screens / desktop (Telegram Web) ---------------- */
/* Global `scroll-behavior: smooth` is intentionally NOT set: it makes every tab
   switch animate the scroll while the new view is painting, which reads as lag.
   In-page scrolls (e.g. "read description") request smooth scrolling directly. */

@media (min-width: 900px) {
  .views { padding: 24px 28px 34px; }
  .app-header {
    padding-left: max(20px, calc((100vw - 1180px) / 2));
    padding-right: max(20px, calc((100vw - 1180px) / 2));
  }
  .banner { min-height: 220px; }
  .banner-overlay { padding: 26px; }
  .banner-overlay h1 { font-size: 26px; }
  .banner-overlay p { font-size: 14px; }
  .brand-name { font-size: 17px; }
  .logo-mark { width: 46px; height: 46px; }
  .balance-chip { padding: 9px 16px; }
  .balance-chip .chip-value { font-size: 16px; }
  #view-wallet, #view-profile { max-width: 720px; margin-inline: auto; }
  .modal { max-width: 600px; }
  .detail-hero { max-width: 460px; margin-inline: auto; }
  .product-thumb { font-size: 52px; }

  /* Floating dock for the tab bar on wide screens */
  .tabbar {
    left: 50%; right: auto; transform: translateX(-50%);
    max-width: 760px; width: calc(100% - 40px);
    border: 1px solid var(--border); border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .28);
    height: var(--tabbar-h);
  }
  .app { padding-bottom: calc(var(--tabbar-h) + 18px); }
  #toast-root { bottom: calc(var(--tabbar-h) + 30px); }
}

@media (min-width: 1280px) {
  .banner { min-height: 260px; }
}

/* Desktop pointer: slim themed scrollbar for a polished Telegram Web feel. */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border: 2px solid var(--bg); border-radius: 999px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--muted); }
}

/* Touch devices: neutralise sticky hover states and drop the most expensive
   compositing work (backdrop blur + always-on decorative animations) that makes
   scrolling stutter on mid/low-end phones. The static gradients keep the look. */
@media (hover: none) {
  .product-card:hover { transform: none; box-shadow: 0 8px 22px rgba(0, 0, 0, .14); border-color: var(--border); }
  .product-card:hover .product-thumb img { transform: none; }
  .list-item:hover { transform: none; }
  .deposit-amt:hover { transform: none; }

  /* Avoid re-blurring sticky bars every scroll frame; keep the photo visible
     through their translucent theme color. */
  .app-header, .tabbar {
    background: var(--chrome-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* Pause infinite decorative motion on touch devices. */
  .banner::after { animation: none; opacity: .5; }
  .app-header::after { animation: none; }
  .balance-card::before { animation: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
