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

:root {
  --bg-deep: #0d1117;
  --bg-mid: #111827;
  --blue-bright: #7ecfe0;
  --blue-mid: #5bbdd4;
  --blue-dark: #3aa0bc;
  --indigo: #2d3a8c;
  --violet: #1e2a5e;
  --cyan: #a8dce8;
  --gold: #d97706;
  --gold-light: #f59e0b;
  --pink: #5bbdd4;
  --green: #3aa0bc;
  --white: #f0f8ff;
  --text-muted: #94a8b8;
  --card-bg: rgba(13, 24, 50, 0.85);
  --card-border: rgba(126, 207, 224, 0.2);
  --radius-card: 28px;
  --shadow-card:
    0 8px 40px rgba(126, 207, 224, 0.13), 0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(126, 207, 224, 0.09);
  --font-ar: "Tajawal", sans-serif;
  --font-mono: "Space Mono", monospace;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  background: #0d1117;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1117 0%, #0f1a35 50%, #0d1117 100%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(16px, 4vw, 40px) clamp(12px, 3vw, 24px) 60px;
  color: var(--white);
  font-family: var(--font-ar);
  overflow-x: hidden;
}

/* ─── Ambient Background — fully disabled ────────────────────── */
.bg-layer {
  display: none;
}

#particles {
  display: none;
}

.orb,
.orb-1,
.orb-2,
.orb-3 {
  display: none;
}

@keyframes orbDrift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -25px) scale(1.06);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.96);
  }
}

/* ─── Layout ──────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 4vw, 28px);
}

/* ─── Header ──────────────────────────────────────────────────── */
.site-header {
  text-align: center;
  padding-top: clamp(8px, 2vw, 20px);
}

.logo {
  width: clamp(160px, 42vw, 260px);
  margin-bottom: 18px;
  animation: logoFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 28px rgba(56, 189, 248, 0.45)) brightness(1.25)
    contrast(1.05);
}
@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(0.8deg);
  }
}

h1 {
  font-size: clamp(26px, 6vw, 46px);
  font-weight: 900;
  background: linear-gradient(
    135deg,
    var(--blue-bright) 0%,
    var(--cyan) 45%,
    var(--violet) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.subtitle {
  font-size: clamp(13px, 3vw, 16px);
  color: #64748b;
  letter-spacing: 0.5px;
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card,
.winner {
  position: relative;
  background: white;
  border-radius: var(--radius-card);
  padding: clamp(20px, 5vw, 36px);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
  animation: cardReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:hover,
.winner:hover {
  transform: translateY(-5px);
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow:
    0 16px 50px rgba(14, 165, 233, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.07);
}

/* Card inner glow accent */
.card-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.12),
    transparent 70%
  );
  pointer-events: none;
}
.card-glow--gift {
  background: radial-gradient(circle, rgba(217, 119, 6, 0.1), transparent 70%);
}

/* Card header row */
.card-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(16px, 4vw, 24px);
  justify-content: center;
}

.icon-badge {
  font-size: clamp(22px, 5vw, 30px);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

h2 {
  font-size: clamp(18px, 4.5vw, 26px);
  font-weight: 900;
  background: linear-gradient(90deg, var(--violet), var(--blue-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Wheel ───────────────────────────────────────────────────── */
.wheel-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: clamp(10px, 3vw, 22px) auto;
  width: clamp(180px, 50vw, 240px);
  height: clamp(180px, 50vw, 240px);
}

.wheel-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.wheel-ring-outer {
  inset: -14px;
  background: conic-gradient(
    from 0deg,
    var(--indigo),
    var(--cyan),
    var(--blue-bright),
    var(--violet),
    var(--indigo)
  );
  opacity: 0.55;
  animation: ringRotate 8s linear infinite;
}
.wheel-ring-mid {
  inset: -7px;
  background: conic-gradient(
    from 180deg,
    var(--blue-dark),
    #ffffff 40%,
    var(--blue-dark)
  );
  opacity: 0.9;
}

.gift-ring {
  background: conic-gradient(
    from 0deg,
    var(--indigo),
    var(--cyan),
    var(--blue-bright),
    var(--violet),
    var(--indigo)
  ) !important;
}

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

.wheel {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;

  /* This removes the blue inside */
  background: #ffffff !important;
  background-image: none !important;

  display: flex;
  justify-content: center;
  align-items: center;

  font-family: var(--font-mono);
  font-size: clamp(26px, 7vw, 48px);
  font-weight: 700;
  color: var(--white);

  border: 3px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.25);

  transition:
    transform 0.15s ease,
    box-shadow 0.3s,
    background 0.3s ease;

  z-index: 1;
  overflow: hidden;
}

.wheel-logo {
  width: 75%;
  height: 75%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}
.wheel.result-mode {
  background-image: none !important;
  background: #0f172a !important;
}

/* Gift wheel: when showing prize image, use white background */
.wheel--gift.result-mode {
  background-image: none !important;
  background: #ffffff !important;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.1),
    0 0 50px rgba(251, 191, 36, 0.4);
}

.wheel--gift {
  background-image: url("img/conto.png") !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-color: white !important;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    0 0 50px rgba(251, 191, 36, 0.3);
}

/* Gift name label below the circle */
.gift-name-tag {
  text-align: center;
  font-family: var(--font-ar);
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 700;
  color: var(--violet);
  margin-top: 10px;
  margin-bottom: 0;
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

/* ─── Slot ticker — FIXED to show full text ───────────────────── */
.wheel-ticker {
  position: relative;
  height: auto;
  min-height: 2.8em;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88%;
  padding: 6px 0;
}

.wheel-inner-text {
  display: block;
  text-align: center;
  line-height: 1.3;
  padding: 6px 4px;
  word-break: break-word;
  white-space: normal;
  max-width: 90%;
  will-change: transform, opacity;
  color: #ffffff;
  font-size: clamp(16px, 5vw, 30px);
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.5);
}

@keyframes tickUp {
  0% {
    transform: translateY(80%);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(0%);
    opacity: 1;
  }
}
@keyframes tickDown {
  0% {
    transform: translateY(-80%);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(0%);
    opacity: 1;
  }
}

.wheel-inner-text.anim-up {
  animation: tickUp 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.wheel-inner-text.anim-down {
  animation: tickDown 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wheel-ticker::before,
.wheel-ticker::after {
  display: none;
}

/* Shimmer overlay */
.wheel-shimmer {
  display: none;
  position: absolute;
  top: -40%;
  left: -40%;
  width: 180%;
  height: 180%;
  background: radial-gradient(
    ellipse at 40% 30%,
    rgba(255, 255, 255, 0.07) 0%,
    transparent 55%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  animation: shimmerMove 5s ease-in-out infinite;
}
@keyframes shimmerMove {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(10%, 10%);
  }
}

/* Spinning state */
.wheel.spinning {
  animation: wheelPulse 0.08s ease-in-out infinite;
}
@keyframes wheelPulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 40px rgba(0, 0, 0, 0.6),
      0 0 50px rgba(99, 102, 241, 0.55);
  }
  50% {
    box-shadow:
      inset 0 0 40px rgba(0, 0, 0, 0.6),
      0 0 80px rgba(99, 102, 241, 0.8),
      0 0 120px rgba(99, 102, 241, 0.35);
  }
}
.wheel--gift.spinning {
  animation: wheelPulseGift 0.08s ease-in-out infinite;
}
@keyframes wheelPulseGift {
  0%,
  100% {
    box-shadow:
      inset 0 0 40px rgba(0, 0, 0, 0.6),
      0 0 50px rgba(251, 191, 36, 0.4);
  }
  50% {
    box-shadow:
      inset 0 0 40px rgba(0, 0, 0, 0.6),
      0 0 80px rgba(251, 191, 36, 0.7),
      0 0 120px rgba(251, 191, 36, 0.3);
  }
}

/* Land animation */
.wheel.landed {
  animation: wheelLand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes wheelLand {
  0% {
    transform: scale(0.88);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(12px, 3vw, 16px) clamp(24px, 6vw, 40px);
  border: none;
  border-radius: 16px;
  font-family: var(--font-ar);
  font-size: clamp(15px, 3.5vw, 19px);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    opacity var(--transition);
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 320px;
  margin-top: 18px;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--blue-mid) 100%);
  color: #fff;
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 14px 36px rgba(99, 102, 241, 0.6),
    0 0 40px rgba(56, 189, 248, 0.3);
}

.btn-gift {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--blue-mid) 100%);
  color: #fff;
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}
.btn-gift:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 14px 36px rgba(251, 191, 36, 0.6),
    0 0 40px rgba(251, 191, 36, 0.3);
}

.btn:active:not(:disabled) {
  transform: scale(0.97) translateY(0);
}

.btn:disabled {
  background: rgba(30, 30, 50, 0.7);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-icon {
  font-size: 1.1em;
  transition: transform 0.3s;
}
.btn:hover:not(:disabled) .btn-icon {
  transform: rotate(20deg) scale(1.2);
}

/* Button ripple */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ─── Counters ────────────────────────────────────────────────── */
.counter {
  margin-top: 14px;
  font-size: clamp(13px, 3vw, 16px);
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.counter strong {
  color: var(--blue-mid);
  font-family: var(--font-mono);
  font-size: 1.05em;
}

/* ─── Winner Card ─────────────────────────────────────────────── */
.winner {
  text-align: center;
  border-color: rgba(217, 119, 6, 0.25);
  box-shadow:
    0 8px 40px rgba(217, 119, 6, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  animation: winnerReveal 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes winnerReveal {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.winner-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(217, 119, 6, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}

.trophy-icon {
  font-size: clamp(44px, 10vw, 70px);
  animation: trophyBounce 1.5s ease-in-out infinite;
  display: block;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.6));
}
@keyframes trophyBounce {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

.winner h2 {
  font-family: "Tajawal", sans-serif;
  font-size: clamp(18px, 3vw, 24px);
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.winner-body {
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: #111827 !important;
}

.winner-body strong {
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #d97706 !important;
}

/* Confetti bar */
.confetti-bar {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.confetti-piece {
  width: 8px;
  height: 22px;
  border-radius: 3px;
  animation: confettiFall 1.2s ease-in-out both;
}
@keyframes confettiFall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translateY(10px) rotate(120deg);
    opacity: 0.6;
  }
}

/* ─── Win Overlay ─────────────────────────────────────────────── */
.win-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}
.burst {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 40px;
}

/* ─── Utility ─────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Cards Row ───────────────────────────────────────────────── */
.cards-row {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 4vw, 28px);
  width: 100%;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  body {
    padding: 12px 10px 50px;
  }
  .wheel-wrapper {
    width: clamp(150px, 60vw, 210px);
    height: clamp(150px, 60vw, 210px);
  }
  .wheel {
    font-size: clamp(22px, 8vw, 36px);
  }
  .btn {
    max-width: 100%;
  }
  .card,
  .winner {
    padding: 20px 16px;
    border-radius: 20px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 1024px) {
  body {
    align-items: flex-start;
    padding: 24px 32px 60px;
  }
  .container {
    max-width: 1100px;
    width: 100%;
    gap: 20px;
    padding-bottom: 60px;
  }
  .site-header {
    padding-top: 0;
  }
  .site-header .logo {
    width: 180px;
    margin-bottom: 10px;
  }
  h1 {
    font-size: 32px;
    margin-bottom: 4px;
  }
  .subtitle {
    font-size: 14px;
  }
  .cards-row {
    flex-direction: row;
    align-items: stretch;
    gap: 24px;
  }
  .cards-row .card {
    flex: 1;
    min-width: 0;
  }
  .wheel-wrapper {
    width: 180px;
    height: 180px;
  }
  .wheel {
    font-size: 36px;
  }
  .winner {
    width: 100%;
  }
  .card {
    padding: 22px 24px;
  }
}

/* ─── Scroll bar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #ffffff;
}
::-webkit-scrollbar-thumb {
  background: var(--indigo);
  border-radius: 4px;
}

/* ─── Focus visible (accessibility) ──────────────────────────── */
:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ─── Popup ───────────────────────────────────────────────────── */
.popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.popup {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 36px 28px 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popupIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popup-glow {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(251, 191, 36, 0.08) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.popup-trophy {
  font-size: 56px;
  margin-bottom: 8px;
}
.popup-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--violet);
  margin-bottom: 16px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.popup-label {
  font-size: 14px;
  color: #64748b;
}
.popup-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--violet);
}
.popup-gift {
  font-size: 14px;
}

.popup-close {
  margin-top: 20px;
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--indigo), var(--blue-mid));
  color: white;
  border: none;
  border-radius: 12px;
  font-family: var(--font-ar);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.popup-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.popup-confetti {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
  flex-wrap: wrap;
}
