/* ===== نجوم السعادة — سماء تفاعلية بدون أي صور خارجية ===== */

* { box-sizing: border-box; }

:root {
  --gold: #f5d995;
  --gold-light: #fff3cd;
  --sky-1: #050817;
  --sky-2: #101a3d;
  --sky-3: #241640;
  --ink: #fdf7e9;
  --muted: #c3cbec;
  --panel: rgba(17, 24, 54, 0.94);
  --panel-line: rgba(232, 206, 146, 0.42);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--sky-1);
  color: var(--ink);
  font-family: "Cairo", Tahoma, Arial, sans-serif;
  text-align: center;
}

/* ===== خلفية السماء ===== */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 50% 118%, #2a3566 0%, transparent 55%),
    linear-gradient(160deg, var(--sky-1) 0%, var(--sky-2) 52%, var(--sky-3) 100%);
}

/* شريط درب التبانة الخفيف */
.sky::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: linear-gradient(112deg,
    transparent 38%,
    rgba(140, 160, 235, 0.10) 48%,
    rgba(220, 200, 255, 0.12) 52%,
    transparent 62%);
  transform: rotate(-10deg);
  pointer-events: none;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}
.nebula-1 { top: -12%; right: -8%; width: 55vw; height: 55vw; background: radial-gradient(circle, #6c5a9a55, transparent 68%); }
.nebula-2 { bottom: -18%; left: -10%; width: 60vw; height: 60vw; background: radial-gradient(circle, #2f6f8a44, transparent 68%); }
.nebula-3 { top: 30%; left: 25%; width: 40vw; height: 40vw; background: radial-gradient(circle, #b98f4e33, transparent 70%); }

/* النجوم غير التفاعلية في الخلفية — طبقة CSS مضمونة الظهور */
.background-stars {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle at 4% 9%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 9% 31%, #f5d995 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 14% 14%, #ffffff 0 1.9px, transparent 2.4px),
    radial-gradient(circle at 18% 52%, #ffffff 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 22% 27%, #f5d995 0 1.5px, transparent 2.1px),
    radial-gradient(circle at 27% 71%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 31% 8%, #ffffff 0 1.8px, transparent 2.3px),
    radial-gradient(circle at 35% 44%, #f5d995 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 39% 19%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 43% 63%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 47% 36%, #ffffff 0 1.9px, transparent 2.4px),
    radial-gradient(circle at 51% 88%, #f5d995 0 1.4px, transparent 2px),
    radial-gradient(circle at 55% 11%, #ffffff 0 1.5px, transparent 2.1px),
    radial-gradient(circle at 59% 56%, #ffffff 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 63% 29%, #f5d995 0 1.7px, transparent 2.2px),
    radial-gradient(circle at 67% 74%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 71% 41%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 75% 17%, #f5d995 0 1.4px, transparent 2px),
    radial-gradient(circle at 79% 64%, #ffffff 0 1.8px, transparent 2.3px),
    radial-gradient(circle at 83% 33%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 87% 86%, #ffffff 0 1.5px, transparent 2px),
    radial-gradient(circle at 91% 21%, #f5d995 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 95% 49%, #ffffff 0 1.7px, transparent 2.2px),
    radial-gradient(circle at 98% 72%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 6% 60%, #ffffff 0 1.4px, transparent 2px),
    radial-gradient(circle at 12% 84%, #f5d995 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 25% 95%, #ffffff 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 45% 90%, #ffffff 0 1.5px, transparent 2px),
    radial-gradient(circle at 65% 92%, #f5d995 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 85% 95%, #ffffff 0 1.4px, transparent 2px),
    radial-gradient(circle at 16% 40%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 37% 5%, #ffffff 0 1.5px, transparent 2px),
    radial-gradient(circle at 57% 79%, #f5d995 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 77% 55%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 89% 63%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 3% 45%, #f5d995 0 1.5px, transparent 2px),
    radial-gradient(circle at 33% 60%, #ffffff 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 69% 4%, #ffffff 0 1.4px, transparent 2px),
    radial-gradient(circle at 93% 8%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 50% 50%, #ffffff 0 1.2px, transparent 1.8px);
  animation: twinkle 6s ease-in-out infinite alternate;
}

.background-stars::before,
.background-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}

.background-stars::before {
  background-image:
    radial-gradient(circle at 7% 18%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 13% 73%, #ffffff 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 19% 6%, #f5d995 0 1px, transparent 1.6px),
    radial-gradient(circle at 23% 45%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 29% 88%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 41% 22%, #ffffff 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 49% 67%, #f5d995 0 1px, transparent 1.6px),
    radial-gradient(circle at 53% 38%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 61% 15%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 69% 52%, #f5d995 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 73% 81%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 81% 26%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 85% 70%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 97% 34%, #f5d995 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 11% 56%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 37% 73%, #ffffff 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 57% 96%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 79% 9%, #ffffff 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 27% 33%, #f5d995 0 1px, transparent 1.6px),
    radial-gradient(circle at 65% 63%, #ffffff 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 45% 13%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 87% 44%, #ffffff 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 15% 27%, #ffffff 0 1px, transparent 1.6px),
    radial-gradient(circle at 71% 66%, #f5d995 0 1.2px, transparent 1.8px);
  animation: twinkle 4s ease-in-out infinite alternate-reverse;
}

.background-stars::after {
  background-image:
    radial-gradient(circle at 21% 63%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 44% 9%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 58% 72%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 76% 38%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 92% 55%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 34% 84%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 8% 71%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 66% 20%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 15% 88%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px),
    radial-gradient(circle at 83% 12%, #ffffff 0 1.8px, rgba(255, 240, 200, 0.35) 2.4px, transparent 4px);
  animation: twinkle 3.2s ease-in-out infinite alternate;
}

/* نقاط إضافية تُبنى بالجافاسكربت فوق الطبقة أعلاه */
.bg-star {
  position: absolute;
  border-radius: 50%;
  background: #ffffff;
  animation: twinkle var(--d, 3s) ease-in-out infinite alternate;
}

/* القمر */
.moon {
  position: absolute;
  top: 5%;
  left: 6%;
  font-size: clamp(58px, 9vw, 110px);
  line-height: 1;
  color: #fff2c8;
  text-shadow: 0 0 26px rgba(255, 233, 170, 0.85), 0 0 70px rgba(255, 214, 120, 0.35);
  animation: moonGlow 4s ease-in-out infinite alternate;
  pointer-events: none;
}

/* حاوية الشهب */
.meteors { position: absolute; inset: 0; overflow: hidden; }

.meteor {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px 1px #ffffff, 0 0 15px 4px rgba(170, 205, 255, 0.75);
  animation: meteorFall var(--dur, 1.6s) linear forwards;
  pointer-events: none;
}
.meteor::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: var(--tail, 150px);
  height: 2px;
  margin-top: -1px;
  border-radius: 2px;
  transform-origin: left center;
  transform: rotate(-45deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(170, 205, 255, 0.5) 45%, rgba(255, 255, 255, 0));
}

/* خط الأفق */
.horizon {
  position: absolute;
  bottom: -120px;
  left: -10%;
  width: 120%;
  height: 220px;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #1b2145, #0a0f22);
  box-shadow: 0 -18px 60px rgba(120, 150, 235, 0.16);
}

/* ===== المحتوى: الصفحة كلها سماء واحدة متصلة ===== */
main { position: relative; z-index: 1; }

.sky-stage {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 92px 22px 132px;
}

.hero {
  position: relative;
  z-index: 2;
  max-width: 720px;
  pointer-events: none;
  text-align: center;
  animation: heroIn 1.1s ease both;
}

/* هالة خفيفة خلف النص ليبقى مقروءًا فوق النجوم */
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -60px -70px;
  background: radial-gradient(ellipse at 50% 45%,
    rgba(5, 8, 23, 0.66) 0%,
    rgba(5, 8, 23, 0.3) 48%,
    transparent 74%);
  filter: blur(8px);
  pointer-events: none;
}

.brand {
  margin: 0;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
}

.hero h1 {
  margin: 20px 0 16px;
  color: var(--gold-light);
  font-size: clamp(30px, 6vw, 54px);
  font-weight: 800;
  line-height: 1.6;
  text-shadow: 0 0 30px rgba(241, 206, 119, 0.45);
}
.hero h1 span { color: #f3d59d; }

.intro {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
  line-height: 2.1;
}

.counter {
  display: inline-block;
  margin-top: 22px;
  padding: 9px 20px;
  border: 1px solid rgba(233, 204, 140, 0.4);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold-light);
  font-size: 14px;
}
.counter span { padding: 0 6px; color: var(--gold); }

/* ===== نجوم تفاعلية على كامل الصفحة ===== */

/* نجوم إضافية تغطي كامل مساحة الصفحة */
.sky-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle at 8% 14%, #ffffff 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 18% 62%, #f5d995 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 26% 28%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 33% 82%, #ffffff 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 42% 12%, #f5d995 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 49% 55%, #ffffff 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 57% 24%, #ffffff 0 1.6px, transparent 2.1px),
    radial-gradient(circle at 63% 74%, #f5d995 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 72% 38%, #ffffff 0 1.5px, transparent 2px),
    radial-gradient(circle at 79% 8%, #ffffff 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 86% 58%, #f5d995 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 94% 30%, #ffffff 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 12% 88%, #ffffff 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 38% 46%, #f5d995 0 1.3px, transparent 1.8px),
    radial-gradient(circle at 68% 90%, #ffffff 0 1.2px, transparent 1.7px),
    radial-gradient(circle at 90% 82%, #f5d995 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 4% 44%, #ffffff 0 1.3px, transparent 1.8px),
    radial-gradient(circle at 30% 6%, #ffffff 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 52% 92%, #ffffff 0 1.4px, transparent 1.9px),
    radial-gradient(circle at 76% 62%, #ffffff 0 1.1px, transparent 1.6px);
  opacity: 0.85;
  animation: twinkle 7s ease-in-out infinite alternate;
}

.stars { position: absolute; z-index: 1; inset: 0; }

.star {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: float var(--fl, 5s) ease-in-out infinite;
  transition: transform 0.25s ease;
}
.star::before {
  content: "";
  width: var(--dot, 8px);
  height: var(--dot, 8px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #ffedb8 45%, rgba(255, 214, 120, 0) 72%);
  box-shadow: 0 0 8px rgba(255, 236, 170, 0.9), 0 0 18px rgba(255, 214, 120, 0.55);
  animation: twinkle var(--tw, 2.4s) ease-in-out infinite alternate;
}
.star.sparkle::before {
  content: "✦";
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: #fff2c4;
  font-size: var(--dot, 20px);
  line-height: 1;
  text-shadow: 0 0 7px #ffffff, 0 0 18px #ffd86a, 0 0 32px #ffb84d;
}

.star:hover,
.star:focus-visible {
  transform: scale(1.75);
  outline: none;
  z-index: 3;
}
.star:hover::before,
.star:focus-visible::before { filter: brightness(1.35); }
.star:focus-visible::before {
  outline: 2px solid rgba(255, 240, 200, 0.85);
  outline-offset: 3px;
  border-radius: 50%;
}
.star.is-read::before { filter: brightness(0.72) saturate(0.65); }

.sky-hint {
  position: absolute;
  z-index: 2;
  bottom: 62px;
  left: 12px;
  right: 12px;
  margin: 0;
  color: #fff0c8;
  font-size: 14px;
  line-height: 2;
  pointer-events: none;
  text-shadow: 0 2px 10px #000000;
}
.hint-star { padding: 0 6px; color: var(--gold); }

.sky-footer {
  position: absolute;
  z-index: 2;
  bottom: 20px;
  left: 12px;
  right: 12px;
  margin: 0;
  color: #99a3c7;
  font-size: 11px;
  line-height: 2;
  pointer-events: none;
  text-shadow: 0 1px 8px #000000;
}

/* ===== نافذة الرسالة ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 8, 23, 0.72);
  opacity: 0;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}
.modal-backdrop.is-open { opacity: 1; }

.message-card {
  position: fixed;
  z-index: 41;
  top: 50%;
  left: 50%;
  width: min(92vw, 640px);
  max-height: 88vh;
  overflow-y: auto;
  margin: 0;
  padding: 34px 26px 30px;
  border: 1px solid var(--panel-line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 40px rgba(221, 187, 100, 0.18);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.message-card.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.card-star {
  font-size: 40px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 22px #ffdd84;
}

.message-kind {
  margin: 12px 0 0;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
}

.message-card h2 {
  margin: 12px 0;
  color: var(--gold-light);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  line-height: 1.8;
}

.message-text {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 2.2;
}

.verse-box {
  margin-top: 24px;
  padding: 22px 16px;
  border: 1px solid rgba(232, 206, 146, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
}
.verse-label { margin: 0; color: var(--gold); font-size: 13px; }
.verse {
  margin: 14px 0;
  color: #fff1cc;
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: clamp(20px, 4.4vw, 27px);
  line-height: 2.2;
}
.verse-source { margin: 0; color: var(--gold); font-size: 14px; }

.close-btn {
  position: absolute;
  top: 14px;
  left: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.close-btn:hover { background: rgba(255, 255, 255, 0.16); transform: rotate(90deg); }

.another-btn {
  margin-top: 24px;
  padding: 13px 28px;
  border: 0;
  border-radius: 30px;
  background: linear-gradient(110deg, #e9c477, #fff0c0);
  color: #18203c;
  font: 700 15px "Cairo", Tahoma, Arial, sans-serif;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
}
.another-btn:hover { transform: translateY(-2px); box-shadow: 0 0 26px rgba(233, 196, 119, 0.55); }

/* ===== التذييل (نص صغير داخل السماء) ===== */

/* ===== الحركات ===== */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes twinkle {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}
@keyframes moonGlow {
  from { text-shadow: 0 0 14px rgba(255, 233, 170, 0.7); }
  to { text-shadow: 0 0 40px rgba(255, 233, 170, 1); }
}
@keyframes meteorFall {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: 1; }
  72% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* ===== الاستجابة ===== */
@media (max-width: 600px) {
  .sky-stage { padding: 96px 18px 126px; }
  .moon { top: 3%; left: 5%; font-size: 54px; }
  .hero::before { inset: -40px -28px; }
  .sky-hint { bottom: 58px; font-size: 13px; }
  .message-card { padding: 28px 18px 26px; }
  .message-text { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
