/* ==========================================================================
   Lyn Wheel — Spin-to-win component
   Namespaced under .lyn-wheel to avoid collisions when enqueued in WordPress.
   Brand tokens:
     --lyn-sage  #718472
     --lyn-gold  #b2a83c
     --lyn-ink   #212121
     --lyn-oat   light oat background
   ========================================================================== */

.lyn-wheel {
  --lyn-sage: #718472;
  --lyn-sage-dark: #5c6d5d;
  --lyn-gold: #b2a83c;
  --lyn-gold-dark: #948a2c;
  --lyn-ink: #212121;
  --lyn-oat: #f4f1e9;
  --lyn-oat-deep: #ece7da;
  --lyn-white: #ffffff;
  --lyn-radius: 20px;
  --lyn-shadow: 0 18px 48px -18px rgba(33, 33, 33, 0.35);

  box-sizing: border-box;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 26px 22px 24px;
  background: linear-gradient(180deg, #fbfaf5 0%, var(--lyn-oat) 100%);
  border: 1px solid rgba(114, 132, 114, 0.16);
  border-radius: var(--lyn-radius);
  box-shadow: var(--lyn-shadow);
  color: var(--lyn-ink);
  font-family: "Jost", "Poppins", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-align: center;
  position: relative;
  /* Dönen disk KARE bir eleman → dönerken köşeleri dışarı taşıp yatay scroll/
     titreme yaratıyordu. Kartı clip'leyerek taşan (görünmez) köşeleri keser. */
  overflow: hidden;
}

.lyn-wheel *,
.lyn-wheel *::before,
.lyn-wheel *::after {
  box-sizing: border-box;
}

/* ---- Header --------------------------------------------------------------- */
.lyn-wheel__eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--lyn-gold-dark);
  font-weight: 600;
  margin: 0 0 6px;
}

.lyn-wheel__title {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--lyn-ink);
}

.lyn-wheel__subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(33, 33, 33, 0.62);
  margin: 0 auto 18px;
  max-width: 300px;
}

/* ---- Wheel stage ---------------------------------------------------------- */
.lyn-wheel__stage {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px;
  aspect-ratio: 1 / 1;
}

/* confetti canvas overlays the whole stage */
.lyn-wheel__confetti {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  pointer-events: none;
  z-index: 5;
}

.lyn-wheel__disc-wrap {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 12px; /* gold rim thickness */
  background:
    linear-gradient(145deg, #d8ce74 0%, var(--lyn-gold) 40%, var(--lyn-gold-dark) 100%);
  box-shadow:
    0 12px 30px -8px rgba(148, 138, 44, 0.55),
    inset 0 2px 4px rgba(255, 255, 255, 0.55),
    inset 0 -3px 6px rgba(0, 0, 0, 0.18);
}

.lyn-wheel__disc-wrap::after {
  /* thin inner ink ring between rim and segments */
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 2px solid rgba(33, 33, 33, 0.08);
  pointer-events: none;
}

.lyn-wheel__canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--lyn-white);
  box-shadow: inset 0 0 26px rgba(33, 33, 33, 0.12);
  /* transition handled in JS via requestAnimationFrame for full control */
}

/* Center hub */
.lyn-wheel__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #f3eede 55%, #e4dcc4 100%);
  border: 3px solid var(--lyn-gold);
  box-shadow:
    0 6px 14px -4px rgba(33, 33, 33, 0.4),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.lyn-wheel__hub-mark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--lyn-sage);
}

/* Fixed pointer at 12 o'clock */
.lyn-wheel__pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 44px;
  z-index: 4;
  filter: drop-shadow(0 4px 5px rgba(33, 33, 33, 0.35));
}

.lyn-wheel__pointer svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- Gate (email + KVKK) -------------------------------------------------- */
.lyn-wheel__gate {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  margin-bottom: 6px;
}

.lyn-wheel__field {
  position: relative;
}

.lyn-wheel__input {
  width: 100%;
  padding: 13px 15px;
  font-size: 14px;
  font-family: inherit;
  color: var(--lyn-ink);
  background: var(--lyn-white);
  border: 1.5px solid rgba(114, 132, 114, 0.3);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lyn-wheel__input::placeholder { color: rgba(33, 33, 33, 0.4); }

.lyn-wheel__input:focus {
  border-color: var(--lyn-sage);
  box-shadow: 0 0 0 3px rgba(114, 132, 114, 0.14);
}

.lyn-wheel__input.is-invalid {
  border-color: #c0563f;
  box-shadow: 0 0 0 3px rgba(192, 86, 63, 0.12);
}

.lyn-wheel__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(33, 33, 33, 0.72);
  cursor: pointer;
  user-select: none;
}

.lyn-wheel__checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1.5px solid rgba(114, 132, 114, 0.5);
  border-radius: 6px;
  background: var(--lyn-white);
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lyn-wheel__checkbox:checked {
  background: var(--lyn-sage);
  border-color: var(--lyn-sage);
}

.lyn-wheel__checkbox:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  /* merkezden konumla + alt kenarın görsel ağırlığı için hafif yukarı kaydır */
  transform: translate(-50%, -55%) rotate(45deg);
}

.lyn-wheel__checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(114, 132, 114, 0.2);
}

.lyn-wheel__consent a {
  color: var(--lyn-sage-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Button --------------------------------------------------------------- */
.lyn-wheel__spin {
  width: 100%;
  margin-top: 14px;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--lyn-sage) 0%, var(--lyn-sage-dark) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgba(92, 109, 93, 0.9);
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.lyn-wheel__spin:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(92, 109, 93, 0.95);
}

.lyn-wheel__spin:not(:disabled):active { transform: translateY(0); }

.lyn-wheel__spin:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
  background: linear-gradient(135deg, #9aa39a 0%, #838d84 100%);
}

.lyn-wheel__spin.is-spinning {
  cursor: progress;
  opacity: 0.85;
}

.lyn-wheel__hint {
  font-size: 11px;
  color: rgba(33, 33, 33, 0.45);
  margin: 10px 0 0;
}

/* ---- Result panel --------------------------------------------------------- */
.lyn-wheel__result {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 26px;
  background: linear-gradient(180deg, rgba(251, 250, 245, 0.97) 0%, rgba(236, 231, 218, 0.98) 100%);
  border-radius: var(--lyn-radius);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.lyn-wheel__result.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.lyn-wheel__result-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: linear-gradient(135deg, var(--lyn-gold) 0%, var(--lyn-gold-dark) 100%);
  box-shadow: 0 10px 22px -8px rgba(148, 138, 44, 0.7);
  color: #fff;
}

.lyn-wheel__result-congrats {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--lyn-gold-dark);
  font-weight: 600;
  margin: 0;
}

.lyn-wheel__result-reward {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  color: var(--lyn-ink);
  margin: 0;
}

.lyn-wheel__result-sub {
  font-size: 13px;
  color: rgba(33, 33, 33, 0.6);
  margin: 0;
  max-width: 260px;
}

.lyn-wheel__coupon {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 260px;
  border: 1.5px dashed var(--lyn-sage);
  border-radius: 12px;
  overflow: hidden;
  background: var(--lyn-white);
}

.lyn-wheel__coupon-code {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--lyn-sage-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lyn-wheel__coupon-copy {
  flex: 0 0 auto;
  padding: 0 16px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  background: var(--lyn-sage);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lyn-wheel__coupon-copy:hover { background: var(--lyn-sage-dark); }
.lyn-wheel__coupon-copy.is-copied { background: var(--lyn-gold-dark); }

.lyn-wheel__cta {
  width: 100%;
  max-width: 260px;
  margin-top: 4px;
  padding: 14px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--lyn-gold) 0%, var(--lyn-gold-dark) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 12px 24px -10px rgba(148, 138, 44, 0.85);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lyn-wheel__cta:hover { transform: translateY(-1px); }

/* ---- Utility -------------------------------------------------------------- */
.lyn-wheel__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lyn-wheel[hidden] { display: none; }

/* ---- Mobile: popup'ın tamamı ekrana sığsın (çarkı ekran yüksekliğine göre küçült) ---- */
@media (max-width: 600px) {
  .lyn-wheel {
    max-width: 380px;
    padding: 18px 16px 16px;
  }
  .lyn-wheel__eyebrow { font-size: 10px; margin-bottom: 4px; }
  .lyn-wheel__title { font-size: 18px; }
  .lyn-wheel__subtitle { font-size: 12px; margin-bottom: 10px; }
  /* çark boyutu = min(genişlik, ekran yüksekliğinin bir payı) → daima sığar */
  .lyn-wheel__stage { max-width: min(300px, 50vh); margin-bottom: 12px; }
  .lyn-wheel__gate { gap: 9px; }
  .lyn-wheel__input { padding: 11px 13px; }
  .lyn-wheel__spin { margin-top: 10px; padding: 13px 18px; font-size: 14px; }
  .lyn-wheel__hint { margin-top: 7px; }
  .lyn-wheel__result { padding: 22px 20px; gap: 9px; }
  .lyn-wheel__result-badge { width: 48px; height: 48px; font-size: 22px; }
  .lyn-wheel__result-reward { font-size: 20px; }
  .lyn-wheel__cta, .lyn-wheel__coupon { max-width: 240px; }
}

/* çok kısa ekranlar (küçük telefon / yatay) → çarkı biraz daha küçült */
@media (max-height: 680px) {
  .lyn-wheel__stage { max-width: min(280px, 42vh); }
  .lyn-wheel__subtitle { margin-bottom: 8px; }
}

/* çok dar kart */
@media (max-width: 380px) {
  .lyn-wheel { padding: 16px 14px 14px; }
  .lyn-wheel__title { font-size: 17px; }
  .lyn-wheel__result-reward { font-size: 19px; }
}
