/* ===========================================================
   عجلة تواق — كل الأنماط داخل .twq-root حتى لا تتعارض مع القالب
   =========================================================== */

.twq-root {
  --twq-brown-500: #A9784B;
  --twq-brown-300: #C9A47A;
  --twq-gold: #F2C230;
  --twq-radius: 22px;
  --twq-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  --twq-ease: cubic-bezier(.22, 1, .36, 1);
  --twq-max: 560px;

  position: relative;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  direction: rtl;
  text-align: center;
  color: #fff;
  font-family: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  border-radius: var(--twq-radius);
  -webkit-font-smoothing: antialiased;
}

.twq-root *,
.twq-root *::before,
.twq-root *::after {
  box-sizing: border-box;
}

.twq-root--nobg {
  background: transparent;
}

.twq-root:not(.twq-root--nobg) {
  background: #1a0a10;
}

/* ---------- الخلفية ---------- */
.twq-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.04);
  filter: saturate(1.05);
}

.twq-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(120% 70% at 50% 8%, rgba(0, 0, 0, .06), rgba(0, 0, 0, .58) 72%),
    linear-gradient(180deg, rgba(26, 10, 16, .62) 0%, rgba(26, 10, 16, .28) 32%, rgba(26, 10, 16, .84) 100%);
}

/* ---------- التخطيط ---------- */
.twq-stage {
  position: relative;
  z-index: 2;
  width: min(var(--twq-max), 100%);
  margin-inline: auto;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- الرأس ---------- */
.twq-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.twq-badge {
  width: min(230px, 56%);
  height: auto;
  aspect-ratio: 979 / 435;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(0, 0, 0, .55));
}

.twq-headline {
  margin: 14px 0 2px;
  padding: 0;
  color: #fff;
  font-size: clamp(24px, 6.4vw, 36px);
  font-weight: 700;
  line-height: 1.42;
  text-shadow: 0 6px 26px rgba(0, 0, 0, .65);
}

.twq-headline span {
  letter-spacing: .06em;
  font-weight: 400;
}

/* ---------- الشاشات ---------- */
.twq-screen {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  animation: twq-rise .55s var(--twq-ease) both;
}

.twq-screen.is-active {
  display: flex;
}

@keyframes twq-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- النص المقوّس ---------- */
.twq-arc {
  width: min(92%, 430px);
  margin: 6px auto -30px;
  display: block;
  overflow: visible;
}

.twq-arc text {
  font-family: "Tajawal", system-ui, Tahoma, sans-serif;
  font-weight: 400;
  font-size: 19px;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, .35);
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* ---------- العجلة ---------- */
.twq-wheel-wrap {
  position: relative;
  width: min(88%, 420px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.twq-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: 0;
  height: 0;
  border-inline: 17px solid transparent;
  border-top: 28px solid var(--twq-gold);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5));
}

.twq-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(145deg, #F6E7D2, var(--twq-brown-500) 45%, #7A5233 70%, #F0DCC2);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .16);
  display: grid;
  place-items: center;
}

.twq-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  border-radius: 50%;
  display: block;
  background: #fff;
}

.twq-hub {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 29%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35), 0 0 0 5px rgba(255, 255, 255, .5);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .18s var(--twq-ease);
  -webkit-tap-highlight-color: transparent;
}

.twq-hub:active {
  transform: scale(.94);
}

.twq-hub img {
  width: 62%;
  height: auto;
  pointer-events: none;
}

.twq-root.is-spinning .twq-hub {
  cursor: default;
}

/* ---------- تلميح ---------- */
.twq-hint {
  margin: 18px 0 0;
  font-size: 15px;
  color: #f0e2d5;
  text-shadow: 0 3px 14px rgba(0, 0, 0, .6);
  animation: twq-breathe 2.4s ease-in-out infinite;
}

@keyframes twq-breathe {
  0%, 100% { opacity: .7; }
  50%      { opacity: 1; }
}

.twq-root.is-spinning .twq-hint {
  animation: none;
  opacity: .75;
}

/* ---------- البطاقة ---------- */
.twq-card {
  width: 100%;
  margin: 18px 0 0;
  background: linear-gradient(180deg, rgba(38, 20, 14, .62), rgba(28, 14, 10, .74));
  border: 1px solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-radius: var(--twq-radius);
  padding: 26px 20px 22px;
  box-shadow: var(--twq-shadow);
}

.twq-result-kicker {
  margin: 0 0 6px;
  font-size: 17px;
  color: #f0e2d5;
}

.twq-result-kicker b {
  font-weight: 400;
  color: var(--twq-brown-300);
}

.twq-result-prize {
  margin: 6px 0 14px;
  padding: 0;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 400;
  line-height: 1.45;
  background: linear-gradient(180deg, #fff, var(--twq-brown-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.twq-result-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .3);
  border: 1px dashed rgba(255, 255, 255, .3);
  font-size: 13px;
  color: #e6d6c6;
}

.twq-result-code b {
  font-size: 19px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 1px;
  direction: ltr;
}

.twq-again {
  width: min(320px, 100%);
  margin-top: 16px;
}

.twq-again-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: #e6d6c6;
  opacity: .65;
}

.twq-again[hidden],
.twq-again-note[hidden] {
  display: none;
}

.twq-foot {
  margin-top: 22px;
  font-size: 12px;
  color: #e8d8c8;
  opacity: .55;
}

/* ---------- الأزرار ---------- */
.twq-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 400;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s var(--twq-ease), box-shadow .2s, filter .2s;
  -webkit-tap-highlight-color: transparent;
}

.twq-btn-primary {
  color: #2a1a10;
  background: linear-gradient(180deg, #F6E7D2 0%, var(--twq-brown-300) 60%, var(--twq-brown-500) 100%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .6);
}

.twq-btn-ghost {
  height: 50px;
  font-size: 15.5px;
  color: #f3e7da;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.twq-btn-ghost:hover {
  background: rgba(255, 255, 255, .12);
}

.twq-btn:active {
  transform: translateY(2px) scale(.99);
}

.twq-btn[disabled] {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

.twq-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(42, 26, 16, .25);
  border-top-color: #2a1a10;
  animation: twq-spin .7s linear infinite;
}

.twq-spinner[hidden] {
  display: none;
}

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

/* ---------- نموذج التسجيل ---------- */
.twq-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.twq-sheet[hidden] {
  display: none;
}

.twq-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 5, 8, .68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .26s var(--twq-ease);
}

.twq-sheet.is-open .twq-sheet-backdrop {
  opacity: 1;
}

.twq-sheet-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(46, 25, 17, .96), rgba(26, 13, 9, .98));
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--twq-radius);
  padding: 26px 20px 22px;
  box-shadow: var(--twq-shadow);
  text-align: center;
  opacity: 0;
  transform: translateY(22px) scale(.97);
  transition: opacity .26s var(--twq-ease), transform .26s var(--twq-ease);
}

.twq-sheet.is-open .twq-sheet-card {
  opacity: 1;
  transform: none;
}

.twq-sheet-close {
  position: absolute;
  inset-inline-start: 12px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .08);
  color: #e8d7c6;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.twq-sheet-close:hover {
  background: rgba(255, 255, 255, .16);
}

.twq-sheet-title {
  margin: 2px 0 4px;
  padding: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 400;
}

.twq-sheet-sub {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: #e6d6c6;
  opacity: .8;
}

/* ---------- الحقول ---------- */
.twq-field {
  text-align: right;
  margin-bottom: 12px;
}

.twq-field label {
  display: block;
  margin: 0 4px 7px;
  font-size: 13px;
  color: #f3e7da;
  opacity: .9;
}

.twq-field input {
  width: 100%;
  height: 54px;
  margin: 0;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  color: #fff;
  background: rgba(0, 0, 0, .28);
  border: 1.5px solid rgba(255, 255, 255, .22);
  border-radius: 14px;
  outline: none;
  box-shadow: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.twq-field input::placeholder {
  color: rgba(255, 255, 255, .42);
}

.twq-field input:focus {
  border-color: var(--twq-brown-300);
  background: rgba(0, 0, 0, .36);
  box-shadow: 0 0 0 4px rgba(201, 164, 122, .18);
}

.twq-field.is-invalid input {
  border-color: #ff8a8a;
  box-shadow: 0 0 0 4px rgba(255, 138, 138, .16);
}

.twq-err {
  display: block;
  min-height: 16px;
  margin: 6px 4px 0;
  font-size: 12px;
  color: #ffb3b3;
}

.twq-form-note {
  margin: 2px 0 16px;
  font-size: 12.5px;
  color: #e9d9c8;
  opacity: .8;
}

.twq-form-error {
  margin: 14px 0 0;
  padding: 11px 14px;
  background: rgba(255, 90, 90, .16);
  border: 1px solid rgba(255, 120, 120, .4);
  border-radius: 12px;
  font-size: 14px;
  color: #ffd9d9;
}

.twq-form-error[hidden] {
  display: none;
}

/* ---------- القصاصات ---------- */
.twq-confetti {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  pointer-events: none;
}

/* ===========================================================
   النافذة المنبثقة المدمجة
   =========================================================== */

.twq-modal {
  position: fixed;
  inset: 0;
  z-index: 999990;
  display: grid;
  place-items: center;
  padding: 16px;
  direction: rtl;
}

.twq-modal[hidden] {
  display: none;
}

.twq-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 4, 7, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .28s var(--twq-ease, ease);
}

.twq-modal.is-open .twq-modal-backdrop {
  opacity: 1;
}

.twq-modal-body {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  opacity: 0;
  transform: translateY(24px) scale(.97);
  transition: opacity .28s ease, transform .28s cubic-bezier(.22, 1, .36, 1);
  -webkit-overflow-scrolling: touch;
}

.twq-modal.is-open .twq-modal-body {
  opacity: 1;
  transform: none;
}

.twq-modal-close {
  position: absolute;
  inset-inline-start: 14px;
  top: 12px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .24);
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, transform .15s;
}

.twq-modal-close:hover {
  background: rgba(0, 0, 0, .68);
  transform: scale(1.06);
}

.twq-root--popup {
  border-radius: 24px;
}

.twq-root--popup .twq-stage {
  padding-top: 34px;
}

.twq-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  font-family: "Tajawal", system-ui, Tahoma, sans-serif;
  font-size: 16px;
  color: #2a1a10;
  background: linear-gradient(180deg, #F6E7D2 0%, #C9A47A 60%, #A9784B 100%);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
}

body.twq-noscroll {
  overflow: hidden;
}

/* ---------- شاشات صغيرة ---------- */
@media (max-height: 760px) {
  .twq-badge { width: min(190px, 48%); }
  .twq-headline { margin-top: 10px; font-size: clamp(21px, 5.8vw, 30px); }
  .twq-arc { margin-bottom: -34px; }
  .twq-stage { padding-top: 20px; }
}

@media (max-width: 420px) {
  .twq-wheel-wrap { width: min(94%, 400px); }
}

@media (prefers-reduced-motion: reduce) {
  .twq-screen { animation: none; }
  .twq-hint { animation: none; }
}
