@font-face {
  font-family: 'BiFont';
  src: url('/fonts/SP.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --cyan: #17e5ff;
  --blue: #3fa9f5;
  --deep-blue: #1c8ff0;
  --bg-grad: linear-gradient(180deg, var(--cyan) 0%, var(--blue) 55%, var(--deep-blue) 100%);
  --card-bg: rgba(255, 255, 255, 0.14);
  --card-border: rgba(255, 255, 255, 0.28);
  --surface: #f4f9ff;
  --surface-2: #ffffff;
  --text-dark: #0e2438;
  --text-muted: #6c8aa3;
  --accent: #2aa9ff;
  --accent-2: #17e5ff;
  --danger: #ff5470;
  --success: #24d17e;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: 'BiFont', 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  background: var(--surface);
  color: var(--text-dark);
  overscroll-behavior-y: contain;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top hero header shared by every page ---------- */
.hero {
  background: var(--bg-grad);
  padding: 18px 18px 46px;
  border-radius: 0 0 32px 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120px 120px at 85% 0%, rgba(255,255,255,0.35), transparent 60%);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand img { width: 26px; height: 26px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  color: #fff; cursor: pointer;
}

/* ---------- Wallet balance card ---------- */
.balance-card {
  margin-top: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-align: center;
}
.balance-label { font-size: 13px; opacity: 0.85; display:flex; align-items:center; justify-content:center; gap:6px;}
.balance-amount { font-size: 36px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; }
.balance-amount small { font-size: 15px; font-weight: 600; opacity: 0.85; margin-right: 6px; }
.balance-actions { display: flex; gap: 10px; margin-top: 18px; }
.balance-actions button {
  flex: 1; border: none; border-radius: 16px; padding: 13px 8px;
  font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.balance-actions .primary { background: #fff; color: var(--deep-blue); }
.balance-actions .ghost { background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.balance-actions .emoji { font-size: 20px; }

/* ---------- Content area ---------- */
.content { padding: 16px 16px calc(90px + var(--safe-bottom)); margin-top: -26px; flex: 1; }
.section-title { font-size: 15px; font-weight: 800; margin: 22px 4px 10px; display:flex; align-items:center; gap:6px;}

.panel {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 24px rgba(23,89,158,0.08);
  padding: 14px;
}

/* Transaction rows */
.tx-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid #eef4fa; }
.tx-row:last-child { border-bottom: none; }
.tx-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tx-icon.credit { background: #e4fbf0; }
.tx-icon.debit { background: #fdeef1; }
.tx-info { flex: 1; min-width: 0; }
.tx-title { font-size: 13.5px; font-weight: 700; }
.tx-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.tx-amount.credit { color: var(--success); }
.tx-amount.debit { color: var(--danger); }

.empty-state { text-align: center; padding: 30px 10px; color: var(--text-muted); font-size: 13.5px; }
.empty-state .emoji { font-size: 40px; display:block; margin-bottom: 8px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0;
  background: #fff; border-top: 1px solid #eaf1f8;
  display: flex; padding: 8px 6px calc(8px + var(--safe-bottom));
  z-index: 40;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; font-family: inherit; font-size: 11px; font-weight: 700;
  color: var(--text-muted); padding: 6px 0; cursor: pointer;
}
.nav-btn .emoji { font-size: 21px; transition: transform .25s; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active .emoji { transform: translateY(-2px) scale(1.08); }

/* ---------- Generic page header for sub-pages (deposit, giftshop) ---------- */
.page-header { display: flex; align-items: center; gap: 10px; }
.page-header h1 { font-size: 17px; font-weight: 800; margin: 0; }
.back-btn { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.2); border: none; color: #fff; font-size: 16px; cursor: pointer; }

/* ---------- Deposit method cards ---------- */
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.method-card {
  background: var(--surface-2); border-radius: var(--radius-md); padding: 18px 12px;
  text-align: center; box-shadow: 0 6px 20px rgba(23,89,158,0.08); cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s, transform .15s;
  position: relative;
}
.method-card:active { transform: scale(0.97); }
.method-card.selected { border-color: var(--accent); }
.method-card .emoji { font-size: 34px; display: block; margin-bottom: 8px; }
.method-card .title { font-size: 13.5px; font-weight: 800; }
.method-card .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.badge-soon {
  position: absolute; top: 8px; left: 8px; background: #fff3cd; color: #92650a;
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 8px;
}
.badge-off { background:#fde8ea; color:#c02a3f; }

/* ---------- Card list (card-to-card) ---------- */
.card-item {
  background: linear-gradient(135deg, var(--cyan), var(--deep-blue));
  border-radius: 18px; padding: 16px; color: #fff; margin-bottom: 12px;
  cursor: pointer; border: 3px solid transparent; position: relative; overflow: hidden;
}
.card-item.selected { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.card-item .num { font-size: 17px; font-weight: 800; letter-spacing: 1.5px; direction: ltr; text-align: center; margin: 10px 0; }
.card-item .meta { display: flex; justify-content: space-between; font-size: 12px; opacity: 0.9; }
.card-item .copy-btn {
  position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,0.25);
  border: none; color: #fff; border-radius: 10px; padding: 5px 9px; font-size: 11px; cursor: pointer;
}

/* ---------- Form elements ---------- */
.field { margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; border: 1.5px solid #e1ecf6; border-radius: 14px; padding: 12px 14px;
  font-family: inherit; font-size: 14px; background: #fbfdff; color: var(--text-dark);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.upload-box {
  border: 2px dashed #c9def2; border-radius: 16px; padding: 22px; text-align: center;
  color: var(--text-muted); font-size: 13px; cursor: pointer; position: relative;
}
.upload-box.has-file { border-color: var(--success); color: var(--success); }
.upload-box input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-box .emoji { font-size: 28px; display: block; margin-bottom: 6px; }

.btn-main {
  width: 100%; padding: 15px; border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--deep-blue)); color: #fff;
  font-family: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 0 8px 20px rgba(42,169,255,0.35);
}
.btn-main:disabled { opacity: 0.5; }
.btn-secondary {
  width: 100%; padding: 14px; border: 1.5px solid #dceafb; border-radius: 16px;
  background: #fff; color: var(--accent); font-family: inherit; font-weight: 800; font-size: 14px; cursor: pointer;
}

/* ---------- Gift shop ---------- */
.search-bar { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 16px; padding: 10px 14px; box-shadow: 0 4px 16px rgba(23,89,158,0.07); }
.search-bar input { border: none; outline: none; flex: 1; font-family: inherit; font-size: 14px; background: transparent; }
.filter-chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; scrollbar-width: none; }
.filter-chip-row::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 20px; background: #eaf4ff; color: var(--accent);
  font-size: 12.5px; font-weight: 700; cursor: pointer; border: 1.5px solid transparent;
}
.chip.active { background: var(--accent); color: #fff; }

.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.gift-card {
  background: var(--surface-2); border-radius: 20px; padding: 14px 10px; text-align: center;
  box-shadow: 0 6px 18px rgba(23,89,158,0.08); cursor: pointer; position: relative;
}
.gift-card:active { transform: scale(0.97); }
.gift-card .icon-wrap {
  width: 66px; height: 66px; margin: 0 auto 8px; border-radius: 18px;
  background: linear-gradient(160deg, #eaf7ff, #dcefff);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  overflow: hidden;
}
.gift-card .icon-wrap img { width: 100%; height: 100%; object-fit: contain; }
.gift-card .g-price { font-size: 13px; font-weight: 800; color: var(--deep-blue); }
.gift-card .g-stars { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.gift-card .limited-badge {
  position: absolute; top: 8px; right: 8px; background: #fff0e0; color: #b96b06;
  font-size: 9.5px; font-weight: 800; padding: 2px 6px; border-radius: 8px;
}

/* ---------- Modal / bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10, 30, 50, 0.45);
  display: flex; align-items: flex-end; z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: all; }
.sheet {
  background: #fff; width: 100%; border-radius: 26px 26px 0 0; padding: 20px 18px calc(24px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.3,1); max-height: 86vh; overflow-y: auto;
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: #e1eaf3; border-radius: 4px; margin: 0 auto 14px; }
.sheet-title { font-size: 16px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.sheet-emoji-hero { font-size: 60px; text-align: center; margin: 10px 0; }
.sheet-emoji-hero img { width: 96px; height: 96px; object-fit: contain; }

.profile-row { display: flex; align-items: center; gap: 12px; background: #f4f9ff; border-radius: 16px; padding: 12px; margin-bottom: 14px; }
.profile-row img, .profile-row .avatar-fallback {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: linear-gradient(135deg,var(--cyan),var(--deep-blue));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800;
}
.profile-row .p-name { font-weight: 800; font-size: 14px; }
.profile-row .p-username { font-size: 12px; color: var(--text-muted); }

.kv-row { display: flex; justify-content: space-between; padding: 9px 2px; font-size: 13.5px; }
.kv-row .k { color: var(--text-muted); }
.kv-row .v { font-weight: 800; }

.toast {
  position: fixed; top: 14px; right: 14px; left: 14px; z-index: 200;
  background: #0e2438; color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 13.5px;
  text-align: center; transform: translateY(-120%); transition: transform .25s; font-weight: 700;
}
.toast.show { transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

.hidden { display: none !important; }

/* subtle bounce for animated-emoji fallbacks */
@keyframes emoji-float { 0%,100% { transform: translateY(0) rotate(0deg);} 50% { transform: translateY(-4px) rotate(-4deg);} }
.emoji-anim { display: inline-block; animation: emoji-float 2.4s ease-in-out infinite; }
@keyframes pulse-soft { 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.06);} }
.emoji-pulse { display:inline-block; animation: pulse-soft 1.8s ease-in-out infinite; }
