/* Performance: font-display swap */
@font-face { font-family: 'Vazirmatn'; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body, button, input, textarea, select, table, th, td {
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
}

:root {
  --primary:   #404773;
  --primary-light: #6B73B3;
  --primary-lighter: #8B93C3;
  --secondary: #eef2ff;
  --pink:      #f472b6;
  --pink-light:#fce7f3;
  --gold:      #f59e0b;
  --gold-light:#fef3c7;
  --purple:    #7c3aed;
  --white:     #ffffff;
  --text:      #222222;
  --text-muted:#666666;
  --border:    #dde3ff;
  --shadow:    0 2px 16px rgba(64,71,115,0.10);
  --shadow-lg: 0 8px 32px rgba(64,71,115,0.18);
  --radius:    16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);

  /* Safari/iOS safe area - کلید اصلی مشکل منو */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 70px;
  --nav-total: calc(var(--nav-h) + var(--safe-bottom));
}

/* ── Reset & Base ── */
html {
  height: 100%;
  /* هیچ‌وقت overflow:hidden نمی‌ذاریم روی html - Safari مشکل می‌ده */
}

body {
  min-height: 100%;
  min-height: 100dvh; /* dynamic viewport height - کلید Safari */
  width: 100vw;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--primary);
  color: var(--text);
  direction: rtl;
  text-align: right;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* ── App Shell ── */
.app-shell {
  width: 100%;
  max-width: 480px;
  /* استفاده از dvh به جای vh - اصلاح Safari address bar */
  height: 100dvh;
  height: 100vh; /* fallback */
  margin: 0 auto;
  background: var(--white);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@supports (height: 100dvh) {
  .app-shell { height: 100dvh; }
}

/* دسکتاپ */
@media (min-width: 481px) {
  body { display: flex; align-items: stretch; justify-content: center; }
  .app-shell { height: 100vh; }
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  /* فضای کافی زیر محتوا برای منو + safe area */
  padding-bottom: var(--nav-total);
  overscroll-behavior: contain;
}

.page-content.no-scroll { overflow: hidden; padding-bottom: 0; }

/* ══════════════════════════════════════
   BOTTOM NAVIGATION - اصلاح Safari/Chrome
══════════════════════════════════════ */
.bottom-nav {
  /* fixed به جای absolute - مطمئن‌ترین راه روی موبایل */
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  /* ارتفاع اصلی + safe area خودکار */
  height: var(--nav-h);
  /* padding برای safe area (notch/home indicator) */
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 999;
  padding-right: 8px;
  padding-left: 8px;
  box-shadow: 0 -4px 24px rgba(64,71,115,0.10);
  /* جلوگیری از کوچک شدن */
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-muted);
  border: none;
  background: none;
  font-size: 10px;
  font-weight: 600;
  flex: 1;
  -webkit-tap-highlight-color: transparent;
}

.nav-item svg { transition: transform 0.2s; }
.nav-item.active, .nav-item:active { color: var(--primary); }
.nav-item.active svg { transform: scale(1.15); }

.nav-item.center-btn {
  background: var(--primary);
  color: var(--white);
  border-radius: 20px;
  padding: 10px 18px;
  transform: translateY(-14px);
  box-shadow: 0 4px 16px rgba(64,71,115,0.35);
  min-width: 76px;
  font-size: 10px;
}

.nav-item.center-btn:active {
  color: var(--white);
  transform: translateY(-12px) scale(0.97);
}

/* ══════════════════════════════════════
   BIRTHDAY LANDING PAGE
══════════════════════════════════════ */
.landing-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(160deg, #fce7f3 0%, #eef2ff 50%, #f5f3ff 100%);
  position: relative;
  overflow: hidden;
}

/* ستاره‌های تزئینی پس‌زمینه */
.landing-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(244,114,182,0.15) 2px, transparent 2px),
    radial-gradient(circle, rgba(124,58,237,0.10) 2px, transparent 2px),
    radial-gradient(circle, rgba(245,158,11,0.12) 2px, transparent 2px);
  background-size: 40px 40px, 60px 60px, 50px 50px;
  background-position: 0 0, 20px 30px, 10px 15px;
  animation: twinkle 4s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes twinkle {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* نوارهای رنگی بالا */
.landing-page::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    #f472b6 0px, #f472b6 20px,
    #a78bfa 20px, #a78bfa 40px,
    #f59e0b 40px, #f59e0b 60px,
    #404773 60px, #404773 80px,
    #6ee7b7 80px, #6ee7b7 100px
  );
}

.landing-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 20px;
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(244,114,182,0.25), 0 2px 8px rgba(0,0,0,0.08);
  animation: logoFloat 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.landing-logo-placeholder {
  width: 120px;
  height: 120px;
  background: var(--primary);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: logoFloat 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(1deg); }
}

.landing-title {
  font-size: 30px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 12px;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.landing-text {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 36px;
  line-height: 1.9;
  max-width: 290px;
  position: relative;
  z-index: 1;
}

/* ── Balloon decorations ── */
.balloon {
  position: absolute;
  width: 32px;
  height: 40px;
  border-radius: 50%;
  opacity: 0.35;
  animation: balloonRise linear infinite;
  pointer-events: none;
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 12px;
  background: currentColor;
  opacity: 0.5;
}

.b1 { background:#f472b6; left:8%;  animation-duration:8s;  animation-delay:0s;   width:28px; height:34px; }
.b2 { background:#a78bfa; right:10%;animation-duration:11s; animation-delay:2s;   width:22px; height:28px; }
.b3 { background:#f59e0b; left:20%; animation-duration:9s;  animation-delay:4s;   width:24px; height:30px; }
.b4 { background:#6ee7b7; right:20%;animation-duration:13s; animation-delay:1s;   width:20px; height:25px; }
.b5 { background:#404773; left:50%; animation-duration:10s; animation-delay:3s;   width:18px; height:22px; }

@keyframes balloonRise {
  0%   { transform: translateY(110vh) rotate(-5deg); opacity:0; }
  10%  { opacity:0.35; }
  90%  { opacity:0.35; }
  100% { transform: translateY(-20vh) rotate(5deg);  opacity:0; }
}

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  min-height: 50px;
  position: relative;
  z-index: 1;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  width: 100%;
  font-size: 17px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(64,71,115,0.28);
  letter-spacing: 0.5px;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(124,58,237,0.20);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--primary);
  border: 2px solid var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  min-height: 36px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════ */
.auth-page {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  justify-content: center;
  background: var(--white);
}

.auth-logo { text-align: center; margin-bottom: 28px; }

.auth-logo-img {
  width: 80px; height: 80px;
  object-fit: contain; border-radius: 20px;
  box-shadow: 0 4px 20px rgba(124,58,237,0.20);
}

.auth-logo-placeholder {
  width: 80px; height: 80px;
  background: var(--primary);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; color: white;
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: 24px; font-weight: 900;
  color: var(--primary);
  text-align: center; margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px; color: var(--text-muted);
  text-align: center; margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }

.form-label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--text); margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  font-family: inherit;
  direction: rtl;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(64,71,115,0.10);
}

.form-input[type="tel"], .form-input[type="number"] {
  direction: ltr; text-align: center; letter-spacing: 2px;
}

/* OTP */
.otp-inputs {
  display: flex; gap: 12px; justify-content: center;
  direction: ltr; margin: 20px 0;
}

.otp-box {
  width: 58px; height: 68px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-size: 28px; font-weight: 800;
  color: var(--primary);
  background: var(--secondary);
  transition: var(--transition);
  font-family: inherit;
}

.otp-box:focus {
  outline: none; border-color: var(--purple);
  background: #f5f3ff;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.12);
  transform: scale(1.06);
}

/* ══════════════════════════════════════
   BIRTHDAY CAKE WHEEL PAGE
══════════════════════════════════════ */
.wheel-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 0;
  height: 100%;
  background: var(--secondary);
  overflow: hidden;
  position: relative;
}

/* نوار تزئینی بالا */
.wheel-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(
    90deg,
    #f472b6 0,#f472b6 16px,
    #a78bfa 16px,#a78bfa 32px,
    #f59e0b 32px,#f59e0b 48px,
    #404773 48px,#404773 64px,
    #6ee7b7 64px,#6ee7b7 80px
  );
}

.wheel-header { text-align: center; margin-bottom: 10px; }

.wheel-header h2 {
  font-size: 17px;
  font-weight: 900;
  color: var(--primary);
}

.quota-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--secondary);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 12px; font-weight: 700;
  margin-top: 6px;
  border: 1.5px solid var(--border);
  box-shadow: none;
}

/* ── کیک تولد روی گردونه ── */
.wheel-wrapper {
  position: relative;
  width: 100%;
  max-width: 310px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto;
  filter: drop-shadow(0 12px 40px rgba(124,58,237,0.22)) drop-shadow(0 4px 12px rgba(244,114,182,0.18));
}

.wheel-canvas {
  width: 100%; height: 100%;
  border-radius: 50%;
}

/* شمع‌های روی گردونه */
.candles-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
}

/* فلش/نشانگر */
.wheel-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 30px solid var(--primary);
  filter: drop-shadow(0 3px 6px rgba(244,114,182,0.6));
  z-index: 10;
  animation: pointerPulse 2s ease-in-out infinite;
}

@keyframes pointerPulse {
  0%, 100% { filter: drop-shadow(0 3px 6px rgba(64,71,115,0.5)); }
  50%       { filter: drop-shadow(0 3px 12px rgba(64,71,115,0.8)); }
}

.spin-btn {
  margin-top: 12px;
  width: 100%; max-width: 200px;
  font-size: 17px; font-weight: 900;
  padding: 14px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--white);
  border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(64,71,115,0.28);
  transition: var(--transition);
  font-family: inherit;
  min-height: 50px;
  letter-spacing: 1px;
  animation: spinBtnPulse 2.5s ease-in-out infinite;
}

@keyframes spinBtnPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(64,71,115,0.28); transform: scale(1); }
  50%       { box-shadow: 0 6px 24px rgba(64,71,115,0.40); transform: scale(1.03); }
}

.spin-btn:active {
  transform: scale(0.96) !important;
  animation: none !important;
}

.spin-btn:disabled {
  background: #ccc; cursor: not-allowed;
  box-shadow: none; animation: none;
  transform: none;
}

/* ══════════════════════════════════════
   WIN MODAL - Birthday Party Style
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: var(--white);
  border-radius: 28px;
  padding: 32px 24px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(0.7) translateY(40px);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

/* نوار رنگی بالای modal */
.modal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 5px;
  background: repeating-linear-gradient(
    90deg,
    #f472b6 0,#f472b6 14px,
    #a78bfa 14px,#a78bfa 28px,
    #f59e0b 28px,#f59e0b 42px,
    #404773 42px,#404773 56px
  );
}

.win-cake-icon {
  width: 90px; height: 90px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--secondary);
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  animation: winIconBounce 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
}

@keyframes winIconBounce {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 26px; font-weight: 900;
  color: var(--primary);
  margin-bottom: 4px;
  animation: fadeSlideUp 0.4s ease 0.3s both;
}

.modal-subtitle {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 6px;
  animation: fadeSlideUp 0.4s ease 0.35s both;
}

.modal-prize {
  font-size: 19px; font-weight: 800;
  color: var(--primary);
  background: rgba(255,255,255,0.7);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  border: 1.5px solid rgba(124,58,237,0.15);
  animation: fadeSlideUp 0.4s ease 0.4s both;
}

.coupon-code-display {
  background: var(--white);
  border: 2.5px dashed #f472b6;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 24px; font-weight: 900;
  color: var(--primary);
  letter-spacing: 3px;
  margin: 12px 0;
  direction: ltr;
  box-shadow: 0 2px 12px rgba(244,114,182,0.15);
  animation: fadeSlideUp 0.4s ease 0.45s both;
  cursor: pointer;
  transition: var(--transition);
}

.coupon-code-display:active {
  background: #f5f3ff;
  transform: scale(0.98);
}

.coupon-sms-note {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 16px;
  animation: fadeSlideUp 0.4s ease 0.5s both;
}

.modal-close-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 99px;
  padding: 14px;
  font-size: 16px; font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(64,71,115,0.25);
  transition: var(--transition);
  animation: fadeSlideUp 0.4s ease 0.55s both;
}

.modal-close-btn:active { transform: scale(0.97); }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   PAGE HEADERS
══════════════════════════════════════ */
.page-header {
  padding: 20px 20px 14px;
  background: var(--secondary);
  border-bottom: 1.5px solid var(--border);
}

.page-header h1 {
  font-size: 20px; font-weight: 900;
  color: var(--primary);
}

.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ══════════════════════════════════════
   PROFILE PAGE
══════════════════════════════════════ */
.profile-card {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}

.profile-avatar {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px; font-weight: 900;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.profile-info h3 { font-size: 17px; font-weight: 800; color: var(--primary); }
.profile-info p  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.level-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 99px; margin-top: 4px;
}

/* Spin history */
.spin-history-list { padding: 0 14px 14px; }

.spin-item {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.spin-item:active { background: #fafbff; }

.spin-item-header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 7px;
}

.spin-item-prize { font-size: 14px; font-weight: 700; color: var(--primary); }
.spin-item-date  { font-size: 11px; color: var(--text-muted); direction: ltr; }
.spin-item-code  { font-size: 13px; font-weight: 800; color: var(--primary); letter-spacing: 1px; direction: ltr; margin-bottom: 7px; }

.status-badges { display: flex; gap: 5px; flex-wrap: wrap; }

.badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: #f3f4f6; color: #6b7280; }

.section-title {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  padding: 14px 14px 6px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 4px;
}

.gift-form { background: var(--secondary); border-radius: var(--radius-sm); padding: 14px; margin-top: 10px; display: none; gap: 8px; }
.gift-form.open { display: flex; flex-direction: column; }

.edit-section { padding: 0 14px 8px; }

.section-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}

/* ══════════════════════════════════════
   REFERRAL PAGE
══════════════════════════════════════ */
.referral-page { padding: 20px 14px; }

.referral-code-card {
  background: var(--primary);
  border-radius: 24px; padding: 24px 20px;
  text-align: center; color: white; margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}



.referral-code-card h3 { font-size: 13px; opacity: 0.85; margin-bottom: 10px; position: relative; }

.referral-code-value {
  font-size: 30px; font-weight: 900; letter-spacing: 4px;
  direction: ltr; margin-bottom: 14px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
}

.referral-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

.stat-card {
  background: var(--secondary);
  border-radius: 14px; padding: 16px;
  text-align: center;
  border: 1.5px solid var(--border);
}

.stat-number { font-size: 28px; font-weight: 900; color: var(--primary); }
.stat-label  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.referral-info {
  background: var(--secondary);
  border-radius: var(--radius); padding: 16px;
  font-size: 14px; color: var(--text); line-height: 1.9;
  border-right: 4px solid var(--primary);
}

/* ══════════════════════════════════════
   ALERTS & UTILS
══════════════════════════════════════ */
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.alert-error   { background: #fef2f2; color: #dc2626; border: 1.5px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0; }
.alert-info    { background: var(--secondary); color: var(--primary); border: 1.5px solid var(--border); }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.88);
  z-index: 1000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}

.spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--secondary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.no-result { text-align: center; padding: 36px 20px; color: var(--text-muted); font-size: 14px; }

/* ══════════════════════════════════════
   CONFETTI & ANIMATIONS
══════════════════════════════════════ */
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
  80%  { opacity: 0.8; }
  100% { transform: translateY(110vh) rotate(720deg) scale(0.5); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  will-change: transform;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.4s cubic-bezier(0.4,0,0.2,1) both; }

@keyframes popIn {
  0%  { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.08); }
  100%{ transform: scale(1); opacity: 1; }
}

.pop-in { animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ══════════════════════════════════════
   iOS Safari / Chrome Mobile Fix
   Safe area inset برای notch و home indicator
══════════════════════════════════════ */

/* اطمینان از نمایش صحیح در همه مرورگرهای موبایل */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    /* بدون این خط در Safari آیفون منو زیر آدرس‌بار می‌رود */
    padding-bottom: calc(env(safe-area-inset-bottom) + 6px);
    height: calc(70px + env(safe-area-inset-bottom));
  }

  .page-content {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .page-content.no-scroll {
    padding-bottom: 0;
  }
}

/* Chrome Android - منو روی نوار ناوبری gesture */
@media screen and (max-width: 480px) {
  .bottom-nav {
    /* z-index بالا مطمئن می‌کند که روی همه چیز نشان داده شود */
    z-index: 9999;
  }
}

/* Safari address bar collapse - استفاده از dvh */
@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
    max-height: 100dvh;
  }

  body {
    min-height: 100dvh;
  }
}

/* گردونه - تنظیم اندازه در صفحات کوچک */
@media screen and (max-height: 700px) {
  .wheel-wrapper { max-width: 260px; }
  .wheel-header h2 { font-size: 15px; }
  .spin-btn { margin-top: 8px; padding: 12px; font-size: 15px; }
  .quota-badge { font-size: 11px; padding: 4px 10px; }
}

@media screen and (max-height: 600px) {
  .wheel-wrapper { max-width: 220px; }
  .spin-btn { margin-top: 6px; min-height: 42px; }
}

/* انیمیشن ورود صفحه auth با پس‌زمینه تولدی */
.auth-page {
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #f472b6 0,#f472b6 16px,
    #a78bfa 16px,#a78bfa 32px,
    #f59e0b 32px,#f59e0b 48px,
    #404773 48px,#404773 64px,
    #6ee7b7 64px,#6ee7b7 80px
  );
}

/* OTP box focus بهتر روی موبایل */
.otp-box:focus {
  outline: none;
  border-color: var(--primary) !important;
  background: var(--secondary);
  box-shadow: 0 0 0 4px rgba(64,71,115,0.12);
  transform: scale(1.08);
}

/* دکمه ورود به جشن - افکت درخشش */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.25),
    transparent
  );
  transform: skewX(-20deg);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { left: -60%; }
  100% { left: 120%; }
}
