/* ===================================================================
   Design tokens
=================================================================== */
:root {
  --bg: #0a0e17;
  --bg-elevated: #0e1420;
  --surface: #131a2b;
  --surface-2: #1a2338;
  --border: #232d45;
  --border-soft: #1a2338;

  --accent: #22e6c5;
  --accent-dim: #16a693;
  --accent-2: #8b7fff;
  --accent-2-dim: #6a5fd6;

  --text: #edf1f9;
  --text-muted: #8391ac;
  --text-faint: #56638020;

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;

  --font-body: "Vazirmatn", -apple-system, Tahoma, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 9px;
}

/* ===================================================================
   Base
=================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* faint drifting grid, purely atmospheric */
.grid-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 18% 8%, rgba(34, 230, 197, 0.10), transparent 40%),
    radial-gradient(circle at 88% 4%, rgba(139, 127, 255, 0.10), transparent 38%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px, 26px 26px;
}

/* ===================================================================
   Header — signature "handshake" signal element
=================================================================== */
header {
  position: relative;
  z-index: 1;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(19, 26, 43, 0.6), transparent);
}
.header-inner { display: flex; align-items: center; gap: 12px; }

.signal { position: relative; width: 34px; height: 34px; flex-shrink: 0; }
.signal-dot {
  position: absolute; inset: 11px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px 1px rgba(34, 230, 197, 0.75);
}
.signal-ring {
  position: absolute; inset: 0;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: ping 2.6s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
}
.signal-ring--2 { animation-delay: 1.3s; }
@keyframes ping {
  0% { transform: scale(0.35); opacity: 0.55; }
  100% { transform: scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .signal-ring { animation: none; opacity: 0; }
}

.header-text h1 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.header-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===================================================================
   Content area
=================================================================== */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
  scrollbar-width: thin;
}
main::-webkit-scrollbar { width: 4px; }
main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* section eyebrow / route divider — reused motif tying to "connection path" */
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted);
  margin: 4px 2px 10px;
  letter-spacing: 0.02em;
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px;
  background: repeating-linear-gradient(90deg, var(--border) 0 5px, transparent 5px 9px);
}

/* ===================================================================
   Cards
=================================================================== */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 10px; color: var(--text);
}
.card h3 .ic { color: var(--accent); font-size: 15px; line-height: 1; }

.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-soft);
}
.stat-row:last-child { border-bottom: none; }
.stat-row span { color: var(--text-muted); }
.stat-row b {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  direction: ltr;
}

/* ===================================================================
   Buttons
=================================================================== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 12px; border: none; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #04211c;
  font-family: var(--font-body);
  font-size: 14.5px; font-weight: 700;
  margin-top: 8px; cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.97); filter: brightness(0.95); }
.btn:disabled {
  opacity: 0.45; background: var(--surface-2); color: var(--text-muted);
}
.btn.outline {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent-dim);
}
.btn.small { width: auto; padding: 9px 16px; font-size: 13px; margin-top: 0; }
.btn.violet { background: linear-gradient(135deg, var(--accent-2), var(--accent-2-dim)); color: #f4f2ff; }

/* ===================================================================
   Product rows
=================================================================== */
.product {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.product:last-child { border-bottom: none; }
.product-name { font-size: 13.5px; font-weight: 600; }
.price {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  font-size: 12.5px;
  margin-top: 3px;
  direction: ltr;
}

/* ===================================================================
   Badges
=================================================================== */
.badge {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid transparent;
}
.badge.approved { background: rgba(52, 211, 153, 0.12); color: var(--success); border-color: rgba(52, 211, 153, 0.3); }
.badge.pending { background: rgba(251, 191, 36, 0.12); color: var(--warning); border-color: rgba(251, 191, 36, 0.3); }
.badge.rejected { background: rgba(251, 113, 133, 0.12); color: var(--danger); border-color: rgba(251, 113, 133, 0.3); }

/* ===================================================================
   Link box (config link) — terminal aesthetic
=================================================================== */
.link-box {
  position: relative;
  background: #060a12;
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  word-break: break-all;
  direction: ltr; text-align: left;
  margin: 10px 0;
}

.order-block { margin-bottom: 16px; }
.order-block:last-child { margin-bottom: 0; }
.qr-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.qr-row img { border-radius: 10px; border: 1px solid var(--border); background: #fff; padding: 6px; }
.qr-row .btn { margin-top: 0; }

/* ===================================================================
   Jackpot machine (گردونه شانس)
=================================================================== */
.jackpot {
  position: relative;
  margin: 4px auto 6px;
  padding: 18px 14px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, #1a2338, #0b0f19 78%);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(139, 127, 255, 0.12), 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.jackpot-title {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700; font-size: 13px; letter-spacing: 0.08em;
  color: var(--accent-2);
  margin-bottom: 14px;
}
.jackpot-title .bulb {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 6px 1px var(--accent-2);
  animation: bulb-blink 1s ease-in-out infinite;
}
.jackpot-title .bulb:nth-child(3) { animation-delay: 0.5s; }
@keyframes bulb-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.marquee {
  display: flex; justify-content: space-between;
  padding: 0 2px; margin-bottom: 10px;
}
.marquee .lamp {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 5px 1px rgba(251, 191, 36, 0.85);
  animation: bulb-blink 1.2s ease-in-out infinite;
}
.marquee .lamp:nth-child(odd) { animation-delay: 0.3s; }

.reels {
  display: flex; gap: 8px;
  background: #05070d;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
}
.reel {
  flex: 1;
  height: 68px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 60%);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  overflow: hidden;
}
.reel-symbol { transition: none; }
.reel.spinning .reel-symbol { animation: reel-jitter 0.09s linear infinite; }
@keyframes reel-jitter {
  0% { transform: translateY(-3px); filter: blur(1px); }
  50% { transform: translateY(3px); }
  100% { transform: translateY(-3px); filter: blur(1px); }
}
.reel.win { border-color: var(--accent); box-shadow: 0 0 14px -2px rgba(34, 230, 197, 0.8); }

.spin-cta {
  display: block; margin: 16px auto 4px;
  width: 130px; padding: 13px 0;
  border: none; border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #a89bff, var(--accent-2) 60%, var(--accent-2-dim));
  color: #fff; font-family: var(--font-body); font-weight: 800; font-size: 14px;
  box-shadow: 0 8px 18px -6px rgba(139, 127, 255, 0.6);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.spin-cta:active { transform: scale(0.95); }
.spin-cta:disabled {
  background: var(--surface-2); color: var(--text-muted); box-shadow: none;
}

.jackpot-result {
  margin-top: 14px; padding: 12px; border-radius: var(--radius-md);
  text-align: center; font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.jackpot-result.win {
  border-color: rgba(34, 230, 197, 0.4);
  color: var(--accent);
  background: rgba(34, 230, 197, 0.08);
}
.jackpot-result.lose { color: var(--text-muted); }
.jackpot-result .code {
  display: inline-block; margin-top: 6px;
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  letter-spacing: 0.05em; color: var(--text);
  direction: ltr;
}

/* ===================================================================
   Bank card visual (شارژ کیف پول)
=================================================================== */
.bank-card {
  position: relative;
  margin: 4px 0 16px;
  padding: 20px 18px 16px;
  border-radius: 16px;
  aspect-ratio: 1.586 / 1;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(circle at 85% -10%, rgba(34, 230, 197, 0.35), transparent 55%),
    radial-gradient(circle at -10% 110%, rgba(139, 127, 255, 0.35), transparent 55%),
    linear-gradient(135deg, #1a2338, #0b0f19);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.bank-card::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 6px);
  pointer-events: none;
}
.bank-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.bank-card-chip {
  width: 34px; height: 25px; border-radius: 5px;
  background: linear-gradient(135deg, #e4d38a, #b89b4a);
}
.bank-card-brand { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.08em; }
.bank-card-number {
  font-family: var(--font-mono); font-size: 19px; font-weight: 600;
  letter-spacing: 0.08em; color: #fff; direction: ltr; text-align: left;
}
.bank-card-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.bank-card-holder-label { font-size: 9.5px; color: var(--text-muted); margin-bottom: 3px; }
.bank-card-holder { font-size: 13px; font-weight: 600; color: var(--text); }
.bank-card-amount { font-family: var(--font-mono); font-size: 13px; color: var(--accent-2); font-weight: 700; direction: ltr; }

.copy-chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  border-radius: 999px; font-size: 11px; padding: 4px 10px; cursor: pointer;
  font-family: var(--font-mono);
}

.receipt-upload {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  position: relative;
  margin-top: 4px;
}
.receipt-upload.has-file { border-color: var(--accent-dim); color: var(--accent); }
.receipt-upload input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.receipt-upload .ic { display: block; font-size: 20px; margin-bottom: 4px; }
.receipt-preview {
  margin-top: 10px; max-width: 100%; max-height: 160px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

/* ===================================================================
   Inputs
=================================================================== */
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  direction: ltr; text-align: left;
}
.input::placeholder { color: var(--text-muted); font-family: var(--font-body); direction: rtl; }
.input:focus { outline: none; border-color: var(--accent-dim); }

/* ===================================================================
   Loading / empty / error states
=================================================================== */
.skeleton-block { display: flex; flex-direction: column; gap: 10px; }
.skel {
  height: 64px; border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.state-msg {
  text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 13px;
}
.state-msg .ic { font-size: 26px; display: block; margin-bottom: 8px; opacity: 0.7; }
.state-msg.error { color: var(--danger); }

/* ===================================================================
   Tab bar
=================================================================== */
#tabbar {
  position: relative; z-index: 1;
  display: flex;
  border-top: 1px solid var(--border-soft);
  background: rgba(14, 20, 32, 0.9);
  backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 8px;
  border: none; background: none;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
  transition: color 0.15s ease;
}
#tabbar button svg { width: 21px; height: 21px; transition: filter 0.15s ease; }
#tabbar button.active { color: var(--accent); font-weight: 700; }
#tabbar button.active::before {
  content: "";
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px 0 rgba(34, 230, 197, 0.8);
}
