/* ============================================
   Cafe Golestan – Game Stylesheet
   Warm café palette · Mobile-first · RTL
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700;900&display=swap');

/* ─── Variables ─────────────────────────────── */
:root {
  --cream:       #FDF6ED;
  --brown-deep:  #2C1A0E;
  --brown-mid:   #5C3317;
  --brown-warm:  #8B4513;
  --gold:        #D4A017;
  --gold-light:  #F0C84A;
  --gold-pale:   #FFF3CC;
  --orange-warm: #E07B39;
  --red-urgent:  #C0392B;
  --green-ok:    #27AE60;
  --text-dark:   #1A0A00;
  --text-mid:    #5A3A1A;
  --text-light:  #A0785A;
  --white:       #FFFFFF;
  --glass:       rgba(255,255,255,0.12);
  --glass-border:rgba(255,255,255,0.25);
  --shadow-warm: 0 20px 60px rgba(44,26,14,0.35);
  --r-md:        14px;
  --r-lg:        22px;
  --r-xl:        32px;
}

/* ─── Reset & Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Vazirmatn', sans-serif;
  background: var(--brown-deep);
  color: var(--cream);
  min-height: 100dvh;
  overflow-x: hidden;
  direction: rtl;
  position: relative;
}

/* ─── Background Scene ───────────────────────── */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #7B3A10, transparent 70%);
  top: -150px; right: -100px;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #D4A017, transparent 70%);
  bottom: -100px; left: -80px;
  animation: orbFloat 16s ease-in-out infinite reverse;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #E07B39, transparent 70%);
  top: 40%; left: 50%;
  animation: orbFloat 10s ease-in-out infinite 3s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -30px) scale(1.05); }
  66%       { transform: translate(-15px, 20px) scale(0.95); }
}

/* Steam rising effect */
.steam {
  position: absolute;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to top, transparent, rgba(255,255,255,0.06), transparent);
  animation: steamRise 4s ease-in infinite;
  opacity: 0;
  border-radius: 2px;
}
.s1 { left: 20%; height: 200px; animation-delay: 0s; }
.s2 { left: 50%; height: 150px; animation-delay: 1.5s; }
.s3 { left: 75%; height: 180px; animation-delay: 3s; }

@keyframes steamRise {
  0%   { opacity: 0; transform: translateY(0) scaleX(1); }
  30%  { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-300px) scaleX(3); }
}

/* ─── App Shell ──────────────────────────────── */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
}

/* ─── Screens ────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100dvh;
  padding: 20px 20px 40px;
  animation: screenIn 0.4s ease forwards;
}
.screen.active { display: flex; }

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

/* ─── Screen Header ──────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 20px;
}

.step-label {
  font-size: 0.8rem;
  color: var(--text-light);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 4px 12px;
  border-radius: 50px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--gold-light);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-back:hover { background: var(--glass); }

.countdown-badge {
  font-size: 0.78rem;
  background: linear-gradient(135deg, var(--red-urgent), #E74C3C);
  color: white;
  padding: 5px 12px;
  border-radius: 50px;
  font-weight: 700;
  animation: urgencyPulse 2s ease-in-out infinite;
}
@keyframes urgencyPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.4); }
  50%     { box-shadow: 0 0 0 8px rgba(192,57,43,0); }
}

/* ─── LANDING SCREEN ─────────────────────────── */
.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: 28px;
  padding: 40px 0;
  text-align: center;
}

.logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.logo-ring {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brown-warm), var(--gold));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(212,160,23,0.4), 0 0 0 4px rgba(212,160,23,0.15);
  animation: logoSpin 20s linear infinite;
  position: relative;
}
.logo-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--gold-light);
  animation: ringRotate 3s linear infinite;
}
@keyframes logoSpin {
  0%   { box-shadow: 0 8px 32px rgba(212,160,23,0.4); }
  50%  { box-shadow: 0 8px 40px rgba(224,123,57,0.5); }
  100% { box-shadow: 0 8px 32px rgba(212,160,23,0.4); }
}
@keyframes ringRotate { to { transform: rotate(360deg); } }

.logo-icon { font-size: 2.6rem; }

.brand-name {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--cream));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 300;
}

/* Hero slogan */
.hero-slogan {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slogan-line1, .slogan-line2, .slogan-line3 {
  font-weight: 700;
  text-align: center;
}
.slogan-line1 {
  font-size: 1.5rem;
  color: var(--cream);
  opacity: 0.9;
}
.slogan-line2 {
  font-size: 1.8rem;
  color: var(--gold-light);
}
.slogan-line3 {
  font-size: 1.4rem;
  color: var(--orange-warm);
}

/* Winner ticker */
.winner-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(212,160,23,0.15);
  border: 1px solid rgba(212,160,23,0.3);
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 0.88rem;
}
.ticker-dot {
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  animation: tickerBlink 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes tickerBlink {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.3; transform: scale(0.7); }
}
.ticker-text strong { color: var(--gold-light); }

/* Start button */
.btn-start {
  position: relative;
  background: linear-gradient(135deg, var(--gold), var(--orange-warm));
  border: none;
  color: var(--brown-deep);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 18px 48px;
  border-radius: var(--r-xl);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 8px 30px rgba(212,160,23,0.5);
  width: 100%;
  max-width: 320px;
}
.btn-start:active { transform: scale(0.97); }
.btn-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
  animation: glowSweep 3s ease-in-out infinite;
}
@keyframes glowSweep {
  0%,100% { opacity: 0; transform: translateX(-100%); }
  50%     { opacity: 1; transform: translateX(100%); }
}
.btn-label { position: relative; z-index: 1; }

.expiry-notice {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
}

/* ─── PHONE SCREEN ───────────────────────────── */
.phone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: 30px;
}

.phone-icon-wrap .phone-icon {
  font-size: 3rem;
  animation: phoneBounce 2s ease-in-out infinite;
}
@keyframes phoneBounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.phone-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold-light);
  text-align: center;
}

.phone-sub {
  font-size: 0.88rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.6;
  max-width: 260px;
}

.input-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.phone-field {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(212,160,23,0.3);
  color: var(--cream);
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 16px 20px;
  border-radius: var(--r-md);
  text-align: center;
  letter-spacing: 0.08em;
  direction: ltr;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
}
.phone-field::placeholder { color: rgba(160,120,90,0.5); letter-spacing: 0; }
.phone-field:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,0.1);
}

.error-msg {
  color: #FF6B6B;
  font-size: 0.85rem;
  text-align: center;
  min-height: 20px;
  animation: shake 0.3s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-6px); }
  75%     { transform: translateX(6px); }
}

.btn-primary {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(135deg, var(--brown-warm), var(--gold));
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 16px 30px;
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 6px 24px rgba(139,69,19,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(139,69,19,0.5); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── SPIN SCREEN ────────────────────────────── */
.spin-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 20px;
}

.spin-prompt {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
  text-align: center;
  animation: promptPulse 2s ease-in-out infinite;
}
@keyframes promptPulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.6; }
}

.wheel-container {
  position: relative;
  width: 320px;
  height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-pointer {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212,160,23,0.8);
  z-index: 10;
  margin-bottom: -8px;
  animation: pointerBounce 1.5s ease-in-out infinite;
}
@keyframes pointerBounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-5px); }
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--brown-warm), 0 0 0 10px var(--gold), var(--shadow-warm);
  display: block;
}

.btn-spin {
  background: linear-gradient(135deg, #E07B39, #D4A017);
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 18px 50px;
  border-radius: var(--r-xl);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 30px rgba(224,123,57,0.5);
  width: 100%;
  max-width: 300px;
}
.btn-spin:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(224,123,57,0.6); }
.btn-spin:active { transform: scale(0.97); }
.btn-spin:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-spin.spinning { animation: spinBtnPulse 0.5s ease-in-out infinite alternate; }
@keyframes spinBtnPulse {
  from { box-shadow: 0 8px 30px rgba(224,123,57,0.5); }
  to   { box-shadow: 0 8px 50px rgba(224,123,57,0.9); }
}

/* ─── RESULT SCREEN ──────────────────────────── */
.result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  justify-content: center;
  gap: 24px;
  padding: 40px 0;
  text-align: center;
}

.result-emoji {
  font-size: 5rem;
  animation: rewardBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes rewardBounce {
  0%   { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.result-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold-light);
  animation: fadeUp 0.4s ease 0.2s both;
}

.result-label {
  font-size: 1.15rem;
  color: var(--cream);
  animation: fadeUp 0.4s ease 0.35s both;
  max-width: 280px;
  line-height: 1.6;
}

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

.reward-code-box {
  background: rgba(212,160,23,0.12);
  border: 2px dashed rgba(212,160,23,0.5);
  border-radius: var(--r-md);
  padding: 20px 30px;
  animation: fadeUp 0.4s ease 0.5s both;
  width: 100%;
  max-width: 300px;
}
.reward-code-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 6px;
}
.reward-code-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.12em;
  direction: ltr;
}
.reward-code-expiry {
  font-size: 0.75rem;
  color: var(--red-urgent);
  margin-top: 6px;
  font-weight: 600;
}

.result-cta {
  background: linear-gradient(135deg, var(--green-ok), #2ECC71);
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 15px 36px;
  border-radius: var(--r-xl);
  cursor: default;
  animation: fadeUp 0.4s ease 0.65s both;
  box-shadow: 0 6px 24px rgba(39,174,96,0.4);
  width: 100%;
  max-width: 300px;
}

.result-footer {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  animation: fadeUp 0.4s ease 0.8s both;
  line-height: 1.7;
}

.confetti-area {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ─── ITEM SELECTION SCREEN ──────────────────── */
.item-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 30px;
}

.item-header {
  text-align: center;
}
.item-trophy {
  font-size: 3.5rem;
  animation: trophySpin 2s ease-in-out infinite;
}
@keyframes trophySpin {
  0%,100% { transform: rotate(-5deg) scale(1); }
  50%     { transform: rotate(5deg) scale(1.1); }
}
.item-header h2 {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--gold-light);
  margin-top: 8px;
}
.item-header p {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(212,160,23,0.25);
  border-radius: var(--r-lg);
  padding: 20px 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  font-family: inherit;
  color: var(--cream);
}
.item-card:hover, .item-card.selected {
  background: rgba(212,160,23,0.18);
  border-color: var(--gold);
  transform: translateY(-3px);
}
.item-card.selected {
  box-shadow: 0 0 0 3px rgba(212,160,23,0.3);
}
.item-card-icon { font-size: 2.2rem; }
.item-card-name { font-size: 0.9rem; font-weight: 700; }
.item-card-sub  { font-size: 0.7rem; color: var(--text-light); }

/* ─── Utility ────────────────────────────────── */
.loading-dots::after {
  content: '...';
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%,20%  { content: ''; }
  40%     { content: '.'; }
  60%     { content: '..'; }
  80%,100%{ content: '...'; }
}

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brown-warm); border-radius: 2px; }

/* ─── Responsive tweaks ──────────────────────── */
@media (max-width: 360px) {
  .item-grid { grid-template-columns: 1fr 1fr 1fr; }
  .item-card-name { font-size: 0.78rem; }
  .brand-name { font-size: 1.7rem; }
}
@media (min-width: 500px) {
  .app-shell {
    max-width: 480px;
    margin: 0 auto;
  }
  .screen { padding: 24px 28px 50px; }
}
