
/* =========================================
   MIDNIGHT DREAM
   Design by Malek
========================================= */

:root {
  --midnight: #171321;
  --dark-plum: #30213d;
  --plum: #493253;
  --lavender: #c49acf;
  --rose: #e9bfd8;
  --cream: #fff8f5;
  --gold: #d8bd83;
  --muted: #b9aabd;
  --glass: rgba(255, 255, 255, 0.055);
  --border: rgba(233, 191, 216, 0.16);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 25px;
}

body {
  min-height: 100vh;
  background: var(--midnight);
  color: var(--cream);
  font-family: "Cairo", sans-serif;
  overflow-x: hidden;
  line-height: 1.8;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 15% 15%, rgba(73, 50, 83, 0.35), transparent 40%),
    radial-gradient(ellipse at 85% 80%, rgba(196, 154, 207, 0.11), transparent 38%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--lavender);
  color: var(--midnight);
}

/* BACKGROUND */

.background-effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.glow {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.16;
}

.glow-one {
  top: -130px;
  right: -100px;
  background: var(--lavender);
}

.glow-two {
  bottom: -150px;
  left: -100px;
  background: #754d8a;
}

.stars-container {
  position: absolute;
  inset: 0;
}

.background-star {
  position: absolute;
  color: var(--rose);
  opacity: 0.35;
  animation: starTwinkle 4s ease-in-out infinite;
}

@keyframes starTwinkle {
  0%, 100% {
    opacity: 0.15;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.25);
  }
}

/* GENERAL */

.container {
  width: min(100% - 32px, 900px);
  margin: auto;
}

section {
  position: relative;
  padding: 85px 0;
  text-align: center;
}

.top-label {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 3px;
  font-weight: 700;
  margin-bottom: 14px;
}

h1,
h2,
h3 {
  line-height: 1.6;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: 15px;
}

.section-description {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 30px;
}

.section-symbol {
  display: block;
  font-size: 2rem;
  color: var(--lavender);
  margin-bottom: 10px;
}

/* WELCOME */

.welcome-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 55px 0;
}

.welcome-decoration {
  position: absolute;
  top: 12%;
  right: 12%;
  color: var(--gold);
  font-size: 1.5rem;
  animation: slowFloat 5s ease-in-out infinite;
}

.main-symbol {
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--rose);
  font-size: 3.5rem;
  margin: 15px 0 25px;
  background: var(--glass);
  box-shadow: 0 0 45px rgba(196, 154, 207, 0.13);
}

.welcome-section h1 {
  font-size: clamp(2.3rem, 7vw, 4rem);
  background: linear-gradient(110deg, var(--cream), var(--rose), var(--gold));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.welcome-subtitle {
  color: var(--muted);
  margin: 8px 0 35px;
}

.login-box {
  width: min(100%, 420px);
  padding: 32px 25px;
  border: 1px solid var(--border);
  border-radius: 25px;
  background: rgba(48, 33, 61, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px);
}

.lock-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.login-box h2 {
  font-size: 1.4rem;
  margin-bottom: 5px;
}

.login-box > p {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-box input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  margin: 22px 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(23, 19, 33, 0.8);
  color: var(--cream);
  text-align: center;
  outline: none;
  transition: 0.3s;
}

.login-box input:focus {
  border-color: var(--lavender);
  box-shadow: 0 0 15px rgba(196, 154, 207, 0.15);
}

.login-box input::placeholder {
  color: #8d7c96;
}

#unlockButton,
#randomMessageButton {
  border: 0;
  border-radius: 12px;
  padding: 12px 25px;
  color: var(--midnight);
  font-weight: 800;
  background: linear-gradient(120deg, var(--rose), var(--lavender));
  box-shadow: 0 7px 25px rgba(196, 154, 207, 0.17);
  transition: transform 0.3s, box-shadow 0.3s;
}

#unlockButton {
  width: 100%;
}

#unlockButton:hover,
#randomMessageButton:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(196, 154, 207, 0.3);
}

.login-message {
  min-height: 25px;
  margin-top: 12px;
  color: var(--rose);
}

.welcome-footer {
  margin-top: 30px;
  color: #81718a;
  font-size: 0.75rem;
  letter-spacing: 1px;
}

/* COUNTDOWN */

.countdown-section {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.countdown-section h2 {
  max-width: 600px;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: min(100%, 600px);
  margin: 30px auto;
  direction: ltr;
}

.time-box {
  padding: 22px 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--glass);
  box-shadow: var(--shadow);
}

.time-box span {
  display: block;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  color: var(--rose);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.time-box small {
  color: var(--muted);
}

.countdown-footer {
  display: flex;
  gap: 12px;
  color: var(--gold);
  font-weight: 700;
}

/* HERO */

.hero-section {
  padding-top: 100px;
  padding-bottom: 75px;
}

.hero-stars,
.closing-stars {
  color: var(--gold);
  letter-spacing: 12px;
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.hero-section h1 {
  font-size: clamp(2rem, 7vw, 3.6rem);
  background: linear-gradient(110deg, var(--cream), var(--rose), var(--gold));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.hero-subtitle {
  color: var(--muted);
  margin-top: 12px;
}

.hero-date {
  display: inline-block;
  margin-top: 28px;
  padding: 8px 24px;
  border: 1px solid var(--border);
  border-radius: 30px;
  color: var(--gold);
  direction: ltr;
  letter-spacing: 3px;
}

.hero-decoration {
  color: var(--lavender);
  font-size: 2rem;
  margin-top: 35px;
  animation: slowFloat 4s ease-in-out infinite;
}

@keyframes slowFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* MUSIC */

.music-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 25px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--glass);
  text-align: right;
}

.music-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.music-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(196, 154, 207, 0.15);
  color: var(--rose);
  font-size: 1.5rem;
}

.music-info h3 {
  font-size: 1rem;
}

.music-info p {
  font-size: 0.78rem;
  color: var(--muted);
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.music-controls button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--dark-plum);
  color: var(--cream);
}

.music-controls input {
  width: 85px;
  accent-color: var(--lavender);
}

/* QUOTE */

.quote-section {
  margin-top: 45px;
  padding: 35px 25px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(73, 50, 83, 0.35), rgba(196, 154, 207, 0.06));
}

.quote-mark {
  display: block;
  color: var(--gold);
  font-size: 3.5rem;
  line-height: 1;
}

.quote-section p {
  color: var(--rose);
  font-size: 1.15rem;
}

.quote-decoration {
  display: block;
  color: var(--gold);
  margin-top: 15px;
}

/* LETTER */

.letter-card {
  max-width: 720px;
  margin: 25px auto 0;
  padding: 35px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--glass);
  text-align: right;
  box-shadow: var(--shadow);
}

.letter-card p {
  color: #e7dce9;
  margin-bottom: 20px;
}

.letter-card p:last-child {
  margin-bottom: 0;
}

/* ENVELOPES */

.envelopes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.envelope {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 155px;
  padding: 22px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--glass);
  color: var(--cream);
  transition: 0.3s;
}

.envelope:hover {
  transform: translateY(-5px);
  border-color: var(--lavender);
  background: rgba(73, 50, 83, 0.4);
}

.envelope-icon {
  font-size: 2rem;
}

.envelope > span:nth-child(2) {
  font-weight: 700;
}

.envelope small {
  color: var(--muted);
  font-size: 0.75rem;
}

.envelope-message {
  position: relative;
  margin-top: 25px;
  padding: 35px 25px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--dark-plum);
  animation: fadeUp 0.4s ease;
}

.envelope-message h3 {
  color: var(--rose);
  margin-bottom: 15px;
}

.envelope-message p {
  color: var(--cream);
  white-space: pre-line;
}

#closeEnvelope,
#closeModal {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--cream);
}

/* QUALITIES */

.qualities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  text-align: right;
}

.quality-card {
  padding: 25px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--glass);
  transition: 0.3s;
}

.quality-card:hover {
  transform: translateY(-4px);
  border-color: var(--lavender);
}

.quality-card > span {
  font-size: 1.8rem;
}

.quality-card h3 {
  margin: 8px 0;
  color: var(--rose);
}

.quality-card p {
  color: var(--muted);
  font-size: 0.87rem;
}

/* TIMELINE */

.timeline {
  max-width: 650px;
  margin: 40px auto 0;
  text-align: right;
}

.timeline-item {
  position: relative;
  padding: 0 40px 35px 0;
  border-right: 1px solid rgba(196, 154, 207, 0.3);
}

.timeline-item:last-child {
  border-right-color: transparent;
}

.timeline-dot {
  position: absolute;
  right: -17px;
  top: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--dark-plum);
  color: var(--gold);
}

.timeline-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--glass);
}

.timeline-card small {
  color: var(--gold);
}

.timeline-card h3 {
  color: var(--rose);
  margin: 5px 0;
}

.timeline-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* RANDOM MESSAGE */

.random-message-card {
  max-width: 550px;
  margin: 25px auto;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--glass);
}

.random-message-card span {
  color: var(--gold);
  font-size: 1.7rem;
}

.random-message-card p {
  color: var(--rose);
  font-size: 1.1rem;
}

/* HIDDEN STARS */

.hidden-stars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin: 35px 0;
}

.hidden-star {
  width: 60px;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--glass);
  color: var(--gold);
  font-size: 1.8rem;
  transition: 0.3s;
}

.hidden-star:hover {
  transform: rotate(20deg) scale(1.12);
  background: var(--dark-plum);
}

.hidden-star.found {
  color: var(--rose);
  background: var(--plum);
  box-shadow: 0 0 20px rgba(196, 154, 207, 0.2);
}

.star-message {
  min-height: 35px;
  color: var(--rose);
}

/* SURPRISE */

.progress-area {
  max-width: 500px;
  margin: 35px auto;
  text-align: right;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.progress-track {
  height: 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lavender), var(--rose), var(--gold));
  transition: width 0.5s ease;
}

.surprise-stages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
}

.stage-card {
  padding: 22px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--glass);
  transition: 0.3s;
}

.stage-card.completed {
  border-color: var(--gold);
  background: rgba(216, 189, 131, 0.08);
}

.stage-number {
  display: block;
  color: var(--gold);
  font-size: 1.5rem;
  font-weight: 800;
}

.stage-card h3 {
  color: var(--rose);
  font-size: 1rem;
}

.stage-card p {
  min-height: 55px;
  color: var(--muted);
  font-size: 0.78rem;
}

.stage-button {
  width: 100%;
  padding: 9px 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--dark-plum);
  color: var(--cream);
  font-size: 0.82rem;
  transition: 0.3s;
}

.stage-button:not(:disabled):hover {
  background: var(--plum);
}

.stage-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stage-feedback {
  min-height: 45px;
  margin-top: 25px;
  color: var(--rose);
}

.final-surprise {
  margin-top: 30px;
  padding: 40px 25px;
  border: 1px solid var(--gold);
  border-radius: 22px;
  background: linear-gradient(130deg, rgba(73, 50, 83, 0.6), rgba(216, 189, 131, 0.08));
  animation: fadeUp 0.7s ease;
}

.final-symbol {
  color: var(--gold);
  font-size: 3rem;
}

.final-surprise h2 {
  color: var(--rose);
}

.final-surprise p {
  color: var(--cream);
}

.final-signature {
  margin-top: 25px;
  color: var(--gold) !important;
  font-weight: 800;
}

/* CLOSING */

.closing-section {
  padding: 100px 0 60px;
}

.closing-section h2 {
  color: var(--rose);
  font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.closing-section > p {
  max-width: 550px;
  margin: 15px auto;
  color: var(--muted);
}

.closing-line {
  width: 90px;
  height: 1px;
  margin: 30px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.signature {
  color: var(--gold) !important;
  font-weight: 800;
  font-size: 1.1rem;
}

.closing-section small {
  color: #81718a;
  font-size: 0.75rem;
}

/* MODAL */

.message-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: min(100%, 450px);
  padding: 45px 25px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--dark-plum);
  text-align: center;
  animation: fadeUp 0.35s ease;
}

.modal-symbol {
  color: var(--gold);
  font-size: 2.5rem;
}

.modal-content h3 {
  color: var(--rose);
  margin: 10px 0;
}

.modal-content p {
  color: var(--cream);
  white-space: pre-line;
}

/* ANIMATIONS */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* RESPONSIVE */

@media (max-width: 600px) {
  .container {
    width: min(100% - 26px, 900px);
  }

  section {
    padding: 65px 0;
  }

  .welcome-section {
    padding: 40px 0;
  }

  .login-box {
    padding: 28px 18px;
  }

  .countdown {
    gap: 7px;
  }

  .time-box {
    padding: 16px 4px;
    border-radius: 13px;
  }

  .music-section {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .music-controls {
    justify-content: center;
  }

  .music-controls input {
    flex: 1;
  }

  .letter-card {
    padding: 23px 18px;
  }

  .envelopes-grid {
    gap: 10px;
  }

  .envelope {
    min-height: 145px;
    padding: 17px 8px;
  }

  .qualities-grid {
    gap: 10px;
  }

  .quality-card {
    padding: 18px 13px;
  }

  .surprise-stages {
    grid-template-columns: 1fr;
  }

  .stage-card p {
    min-height: auto;
    margin: 5px 0 12px;
  }

  .hero-section {
    padding-top: 75px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* EXTRA POLISH */

.message-pop {
  animation: messagePop 0.45s ease;
}

@keyframes messagePop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stage-card.completed {
  border-color: var(--gold);
  box-shadow: 0 0 25px rgba(216, 189, 131, 0.12);
}

.stage-card.completed .stage-button {
  border-color: var(--gold);
  color: var(--gold);
  opacity: 0.85;
}

.hidden-star.found {
  color: var(--rose);
  background: var(--plum);
  box-shadow: 0 0 20px rgba(196, 154, 207, 0.25);
  transform: scale(1.1);
}

.celebration-particle {
  position: fixed;
  top: -40px;
  z-index: 50;
  pointer-events: none;
  animation: celebrationFall 4s ease-in forwards;
}

@keyframes celebrationFall {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0deg);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(360deg);
  }
}
/* رسالة عيد الميلاد النهائية */
.final-letter {
  margin-top: 35px;
  animation: messagePop 0.8s ease both;
}

.final-letter .letter-card {
  line-height: 2.1;
}

.final-letter .letter-card p {
  margin-bottom: 22px;
}

.final-letter .final-signature {
  text-align: center;
  color: var(--gold);
  font-weight: 800;
  margin-top: 30px;
}

#revealMainLetter {
  margin-top: 20px;
}