/* ===== خط Codec Pro (يدعم العربية) ===== */
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-News.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Regular.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Codec Pro';
  src: url('/fonts/CodecPro-Heavy.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

:root {
  --primary: #F0B429;
  --bg: #0E1220;
  --text: #FFFFFF;
  --muted: rgba(255, 255, 255, .72);
  --glass: rgba(255, 255, 255, .13);
  --glass-border: rgba(255, 255, 255, .32);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Codec Pro', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ===== المسرح: 1080×1920 يتقلّص ليناسب أي شاشة ===== */
#stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1080px;
  height: 1920px;
  transform: translate(-50%, -50%) scale(1);
  background: var(--bg);
  overflow: hidden;
  color: var(--text);
}

#bgImage {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .5s;
}
#bgImage.visible { opacity: 1; }
#bgImage.visible::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 24, .42), rgba(10, 12, 24, .62));
}

/* توهّج خفيف يعطي عمق بدون ضجيج بصري */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 46% at 50% -6%, rgba(255, 255, 255, .065), transparent 60%),
    radial-gradient(ellipse 120% 60% at 50% 112%, rgba(0, 0, 0, .5), transparent 62%);
}

/* ===== الشاشات + حركة الدخول ===== */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 90px 100px;
  text-align: center;
  z-index: 1;
}

/* لو زادت الحقول عن ارتفاع الشاشة، اسمح بالتمرير بدل القص */
#screen-lead { overflow-y: auto; }

.hidden { display: none !important; }

.screen.enter > * {
  animation: rise .65s cubic-bezier(.16, 1, .3, 1) both;
}
.screen.enter > *:nth-child(2) { animation-delay: .07s; }
.screen.enter > *:nth-child(3) { animation-delay: .14s; }
.screen.enter > *:nth-child(4) { animation-delay: .21s; }

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

/* ===== شاشة الليد ===== */
#logo {
  max-height: 230px;
  max-width: 640px;
  object-fit: contain;
  margin-bottom: 50px;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, .35));
}

/* الشعار فوق العجلة */
#wheelLogo {
  max-height: 150px;
  max-width: 480px;
  object-fit: contain;
  margin-bottom: 48px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35));
}

.lead-head { margin-bottom: 66px; }

#welcomeTitle {
  font-size: 82px;
  font-weight: 900;
  line-height: 1.22;
  letter-spacing: -.5px;
  margin-bottom: 18px;
}

#welcomeSubtitle {
  font-size: 34px;
  font-weight: 400;
  color: var(--muted);
}

#leadForm {
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
}

#leadFields {
  display: flex;
  flex-direction: column;
  gap: 42px;
}

/* مجموعة حقل: عنوان صغير فوق + الحقل تحت */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: right;
}

.field-label {
  font-size: 27px;
  font-weight: 700;
  color: rgba(255, 255, 255, .95);
  padding-right: 8px;
  letter-spacing: .2px;
  line-height: 1;
}
.field-label .req { color: var(--primary); margin-right: 4px; }

.lead-input {
  width: 100%;
  height: 100px;
  padding: 0 34px;
  font-family: inherit;
  font-size: 33px;
  font-weight: 500;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--glass-border);
  border-radius: 22px;
  outline: none;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.lead-input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, .18);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 14%, transparent);
}
.lead-input::placeholder { color: rgba(255, 255, 255, .45); font-weight: 400; }
.lead-input.ltr { direction: ltr; text-align: right; }

/* حقل نعم / لا */
.yesno-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.yesno-btn {
  height: 94px;
  font-family: inherit;
  font-size: 31px;
  font-weight: 700;
  color: var(--text);
  background: var(--glass);
  border: 2px solid var(--glass-border);
  border-radius: 22px;
  cursor: pointer;
  transition: all .22s;
}
.yesno-btn:active { transform: scale(.97); }
.yesno-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #14161f;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 32%, transparent);
}

#startBtn {
  margin-top: 56px;
  height: 122px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: inherit;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #14161f;
  background: var(--primary);
  border: none;
  border-radius: 26px;
  cursor: pointer;
  box-shadow: 0 18px 48px color-mix(in srgb, var(--primary) 26%, transparent);
  transition: transform .16s, opacity .25s, box-shadow .25s;
}
#startBtn:active { transform: scale(.975); }
#startBtn:disabled {
  opacity: .3;
  box-shadow: none;
  cursor: not-allowed;
}
#startBtn svg { transform: rotate(180deg); }

/* ===== سطر الحقوق ===== */
#copyright {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 400;
  color: rgba(255, 255, 255, .55);
  z-index: 2;
  pointer-events: none;
}

/* ===== شاشة العجلة ===== */
/* المحتوى يبدأ من فوق بدل التوسّط — الشعار أعلى ومسافات مريحة */
#screen-wheel {
  justify-content: flex-start;
  padding-top: 96px;
}

.wheel-head { margin-bottom: 60px; }

#wheelTitle {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -.5px;
  line-height: 1.3;
  margin-bottom: 24px;
}

#wheelGreeting {
  font-size: 34px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
  min-height: 44px;
}

#wheelWrap {
  position: relative;
  width: 1000px;
  height: 1000px;
}

#wheel {
  width: 1000px;
  height: 1000px;
  display: block;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .55));
}

#pointer {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45));
  transition: transform .09s ease-out;
}
#pointer.flick { transform: translateX(-50%) rotate(-9deg); }

#spinBtn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 224px;
  height: 224px;
  border-radius: 50%;
  border: 7px solid rgba(255, 255, 255, .95);
  background: var(--primary);
  color: #14161f;
  font-family: inherit;
  font-size: 52px;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 14px rgba(10, 12, 24, .55),
    0 18px 44px rgba(0, 0, 0, .5);
  animation: breathe 2.4s ease-in-out infinite;
  transition: transform .15s;
}
#spinBtn:active { transform: translate(-50%, -50%) scale(.94); }
#spinBtn:disabled { animation: none; cursor: default; }

@keyframes breathe {
  0%, 100% {
    box-shadow:
      0 0 0 14px rgba(10, 12, 24, .55),
      0 18px 44px rgba(0, 0, 0, .5),
      0 0 0 0 color-mix(in srgb, var(--primary) 34%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 14px rgba(10, 12, 24, .55),
      0 18px 44px rgba(0, 0, 0, .5),
      0 0 0 30px color-mix(in srgb, var(--primary) 0%, transparent);
  }
}

#spinBtnImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#wheelHint {
  margin-top: 48px;
  font-size: 30px;
  font-weight: 400;
  color: var(--muted);
}

/* ===== شاشة الجائزة ===== */
#screen-reveal { z-index: 2; }

#prizeGlow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1400px;
  height: 1400px;
  transform: translate(-50%, -58%);
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 13%, transparent), transparent 58%);
  pointer-events: none;
}

#prizeCard {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

#prizeCard > * { animation: rise .6s cubic-bezier(.16, 1, .3, 1) both; }
#prizeCard > #prizeImageWrap {
  animation: prizePop .8s cubic-bezier(.22, 1.6, .36, 1) both;
}
#prizeCard > h2 { animation-delay: .25s; }
#prizeCard > h1 { animation-delay: .37s; }
#prizeCard > p  { animation-delay: .5s; }

@keyframes prizePop {
  0% { transform: scale(.25) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

#prizeImageWrap {
  width: 560px;
  height: 560px;
  border-radius: 50%;
  overflow: hidden;
  border: 10px solid var(--primary);
  box-shadow:
    0 0 0 22px color-mix(in srgb, var(--primary) 10%, transparent),
    0 40px 90px rgba(0, 0, 0, .6);
  margin-bottom: 66px;
  background: var(--glass);
}

#prizeImage, #prizeColorBlock {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#prizeColorBlock {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 66px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, .35);
  padding: 44px;
  line-height: 1.3;
}

#revealText {
  font-size: 52px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 10px;
}

#prizeLabel {
  font-size: 104px;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--prize-color, var(--primary));
  margin-bottom: 24px;
  line-height: 1.18;
}

#winnerName {
  font-size: 40px;
  font-weight: 500;
  color: rgba(255, 255, 255, .82);
}

/* شريط العد التنازلي — بالمنتصف تحت الجائزة */
#countdownTrack {
  margin-top: 64px;
  width: 560px;
  height: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .14);
  z-index: 2;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, .35),
    0 0 30px color-mix(in srgb, var(--primary) 22%, transparent);
  overflow: hidden;
}
#countdownBar {
  position: relative;
  height: 100%;
  width: 100%;
  border-radius: 16px;
  background: linear-gradient(90deg,
    var(--primary),
    color-mix(in srgb, var(--primary) 55%, #fff));
  box-shadow: 0 0 18px color-mix(in srgb, var(--primary) 65%, transparent);
  transform-origin: right;
}
/* لمعة متحركة داخل الشريط */
#countdownBar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%);
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

#confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* ===== توست ===== */
#toast {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 22, 31, .92);
  border: 1.5px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 30px;
  font-weight: 500;
  padding: 24px 54px;
  border-radius: 20px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .45);
  z-index: 10;
  white-space: nowrap;
  animation: rise .35s cubic-bezier(.16, 1, .3, 1);
}
