:root {
  --night: #0b1026;
  --night-2: #141b3d;
  --indigo: #232a5c;
  --cream: #fff3dc;
  --cream-dim: #c9c3d8;
  --muted: #8f8aa8;
  --gold: #ffcf6e;
  --amber: #ff9f43;
  --pink: #ff8fa3;
  --paper: #fff8ec;
  --ink: #2b2335;
  --radius: 22px;
  --ruqaa: "Aref Ruqaa", "IBM Plex Sans Arabic", serif;
  --sans: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background: radial-gradient(ellipse at 50% 120%, #3a2350 0%, transparent 55%),
    linear-gradient(180deg, #060918 0%, var(--night) 45%, var(--night-2) 100%) fixed,
    var(--night);
  color: var(--cream);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

.sky,
.fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky {
  z-index: 0;
}

.fireworks {
  z-index: 5;
}

main {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
  padding: 72px 16px 64px;
  text-align: center;
}

.scene {
  display: none;
}

.scene.is-active {
  display: block;
  animation: scene-in 0.8s ease both;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--ruqaa);
  font-weight: 700;
  line-height: 1.35;
}

h1 {
  font-size: clamp(46px, 14vw, 72px);
}

h1 span,
h2 span {
  color: var(--gold);
  text-shadow: 0 0 24px rgba(255, 207, 110, 0.5);
}

h2 {
  font-size: clamp(38px, 11vw, 54px);
}

.sub,
.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Buttons */
.glow-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 15px 30px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  color: var(--night);
  font-weight: 600;
  font-size: 17px;
  box-shadow: 0 0 0 0 rgba(255, 207, 110, 0.6), 0 12px 34px rgba(255, 159, 67, 0.35);
  animation: pulse 2.4s ease-in-out infinite;
}

.glow-button[hidden] {
  display: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 110, 0.45), 0 12px 34px rgba(255, 159, 67, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(255, 207, 110, 0), 0 12px 34px rgba(255, 159, 67, 0.35); }
}

.ghost-button {
  margin-top: 22px;
  padding: 11px 20px;
  border: 1px solid rgba(43, 35, 53, 0.25);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
}

/* Sound toggle */
.sound-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 243, 220, 0.2);
  border-radius: 50%;
  background: rgba(11, 16, 38, 0.7);
  backdrop-filter: blur(8px);
}

.sound-toggle[hidden] {
  display: none;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}

.bars i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite alternate;
}

.bars i:nth-child(2) { animation-delay: 0.2s; }
.bars i:nth-child(3) { animation-delay: 0.4s; }
.bars i:nth-child(4) { animation-delay: 0.1s; }

.sound-toggle.is-muted .bars i {
  animation: none;
  transform: scaleY(0.2);
  opacity: 0.6;
}

@keyframes eq {
  from { transform: scaleY(0.25); }
  to { transform: scaleY(1); }
}

.yt-holder {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 200px;
  height: 113px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* Intro */
.big-heart {
  display: block;
  width: 104px;
  margin: 0 auto 26px;
  fill: url(#heart-gradient);
  filter: drop-shadow(0 0 22px rgba(255, 40, 70, 0.6));
  animation: beat 1.4s ease-in-out infinite;
}

@keyframes beat {
  0%, 40%, 100% { transform: scale(1); }
  15% { transform: scale(1.12); }
  28% { transform: scale(1.04); }
}

.lyric {
  margin: 18px auto 0;
  font-family: var(--ruqaa);
  font-size: clamp(22px, 6.4vw, 30px);
  color: var(--pink);
}

.intro-copy {
  margin: 16px auto 0;
  max-width: 440px;
  font-size: 18px;
}

.intro-copy.en {
  margin-top: 4px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-dim);
}

/* Hanging hearts */
.hearts {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 26px -4px 0;
  padding-top: 6px;
  min-height: 170px;
  border-top: 2px solid rgba(255, 243, 220, 0.25);
}

.heart {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
  transform-origin: top center;
  animation: sway var(--sway, 3s) ease-in-out infinite alternate;
}

@keyframes sway {
  from { transform: rotate(-3deg); }
  to { transform: rotate(3deg); }
}

.heart-string {
  width: 1px;
  height: var(--drop, 20px);
  background: rgba(255, 243, 220, 0.4);
}

.heart-shape {
  width: clamp(40px, 11vw, 54px);
  margin-top: -4px;
  fill: #2c3263;
  stroke: rgba(255, 243, 220, 0.25);
  stroke-width: 0.8;
  transition: fill 0.5s ease, filter 0.5s ease;
}

.heart-num {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.heart.is-lit .heart-shape {
  fill: url(#heart-gradient);
  stroke: rgba(255, 255, 255, 0.5);
  filter: drop-shadow(0 0 10px rgba(255, 50, 80, 0.9)) drop-shadow(0 0 26px rgba(220, 20, 50, 0.5));
  animation: beat 1.4s ease-in-out infinite;
}

.heart.is-lit .heart-num {
  color: var(--pink);
}

.heart.is-current .heart-num::after {
  content: " ♡";
}

.night-card {
  display: grid;
  align-content: center;
  margin-top: 18px;
  padding: 22px 20px;
  min-height: 170px;
  border-radius: var(--radius);
  background: rgba(20, 27, 61, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 207, 110, 0.18), 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.night-card p {
  margin: 0 0 8px;
  font-size: 18px;
  opacity: 0;
  animation: line-in 0.8s ease forwards;
}

.night-card p:last-child {
  margin-bottom: 0;
}

.night-card p[dir="auto"]:last-child {
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-dim);
}

.night-card .night-name {
  font-family: var(--ruqaa);
  font-size: 28px;
  color: var(--gold);
  animation-delay: 0s;
}

.night-placeholder {
  color: var(--muted);
  opacity: 1 !important;
  animation: none !important;
}

@keyframes line-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

.counter {
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--gold);
}

/* Two stars */
.stars-track {
  --closeness: 0;
  --travel: calc((50% - 4% - 60px) * var(--closeness));
  position: relative;
  height: 210px;
  margin: 20px 0 6px;
}

.star {
  position: absolute;
  top: 70px;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  background: radial-gradient(circle, #fff9e6, var(--gold));
  filter: drop-shadow(0 0 12px rgba(255, 207, 110, 0.8));
  transition: transform 0.9s ease, opacity 0.9s ease;
}

.star-me {
  left: calc(4% + var(--travel));
}

.star-you {
  right: calc(4% + var(--travel));
  background: radial-gradient(circle, #ffe6ee, var(--pink));
}

/* Names (and nicknames) sit under the stars, outside the clipped star shape. */
.stars-track::before,
.stars-track::after {
  position: absolute;
  top: 110px;
  width: 120px;
  font-family: var(--ruqaa);
  font-size: 22px;
  line-height: 1.4;
  white-space: pre-line;
  direction: rtl;
  text-align: center;
  color: var(--cream);
  transition: opacity 0.6s ease;
}

.stars-track::before {
  content: "أحمد\A(كوتي)";
  left: calc(4% - 28px + var(--travel));
}

.stars-track::after {
  content: "هاجر\A(كوتي بوتي)";
  right: calc(4% - 28px + var(--travel));
}

.stars-track.has-met::before,
.stars-track.has-met::after {
  opacity: 0;
}

.meet-glow {
  position: absolute;
  top: 70px;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 120, 140, 0.9), rgba(227, 18, 47, 0.35) 50%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.has-met .meet-glow {
  transform: translate(-50%, -50%) scale(10);
}

/* When they meet, the two stars melt into one beating heart. */
.has-met .star {
  transform: scale(0.3);
  opacity: 0;
}

.meet-heart {
  position: absolute;
  top: 70px;
  left: 50%;
  width: 120px;
  margin: -60px 0 0 -60px;
  fill: url(#heart-gradient);
  filter: drop-shadow(0 0 18px rgba(255, 40, 70, 0.8));
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 0.8s ease 0.3s, transform 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) 0.3s;
}

.has-met .meet-heart {
  opacity: 1;
  transform: scale(1);
  animation: beat 1.4s ease-in-out 1.3s infinite;
}

.meet-names {
  position: absolute;
  top: 140px;
  left: 0;
  right: 0;
  margin: 0;
  font-family: var(--ruqaa);
  font-size: clamp(26px, 7.5vw, 34px);
  color: var(--cream);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.8s ease 1s, transform 0.8s ease 1s;
}

.has-met .meet-names {
  opacity: 1;
  transform: none;
}

.hold-button {
  position: relative;
  overflow: hidden;
  width: min(320px, 100%);
  margin-top: 10px;
  padding: 18px 24px;
  border: 1px solid rgba(255, 207, 110, 0.5);
  border-radius: 999px;
  background: rgba(20, 27, 61, 0.7);
  color: var(--cream);
  font-size: 17px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.hold-button[hidden] {
  display: none;
}

.hold-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 207, 110, 0.55), rgba(255, 143, 163, 0.55));
  transform: scaleX(0);
  transform-origin: left;
}

.hold-label {
  position: relative;
}

.closer-answer {
  margin: 0;
  font-family: var(--ruqaa);
  font-size: clamp(40px, 12vw, 58px);
  color: var(--gold);
  text-shadow: 0 0 26px rgba(255, 207, 110, 0.55);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 1s ease 0.4s, transform 1s ease 0.4s;
}

.closer-answer.is-shown {
  opacity: 1;
  transform: none;
}

/* Letter */
.letter {
  padding: 34px 26px 28px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 60px rgba(255, 207, 110, 0.2), 0 30px 70px rgba(0, 0, 0, 0.45);
}

.letter .eyebrow {
  color: #b5734f;
}

.letter h2 {
  margin-bottom: 14px;
  color: #8a3b55;
}

.letter-body {
  text-align: start;
}

.letter-body p {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.85;
}

.letter-body p:not([dir]) {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
}

.letter-love {
  margin-top: 20px !important;
  text-align: center;
  font-family: var(--ruqaa);
  font-size: 36px !important;
  color: #c2456a;
}

.letter-sign {
  text-align: center;
  font-family: var(--ruqaa);
  font-size: 22px !important;
  color: #6b5a6e;
}

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

/* Photo (shown only when assets/us.jpg exists) */
.photo {
  width: min(260px, 80%);
  margin: 4px auto 22px;
  padding: 10px 10px 6px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(43, 35, 53, 0.25);
  transform: rotate(-2.5deg);
}

.photo[hidden] {
  display: none;
}

.photo img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
}

.photo figcaption {
  margin-top: 6px;
  font-family: var(--ruqaa);
  font-size: 22px;
  color: #8a3b55;
}

.wishes {
  list-style: none;
  margin: 22px 0;
  padding: 18px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 207, 110, 0.22), rgba(255, 143, 163, 0.2));
  text-align: center;
}

.wishes li {
  font-family: var(--ruqaa);
  font-size: clamp(21px, 5.8vw, 26px);
  line-height: 1.6;
  color: #7a2f4a;
}

.wishes li + li {
  margin-top: 10px;
}

h1 .h1-en {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 0.72em;
  color: var(--cream);
  text-shadow: none;
}

/* Sorry for the cringe */
.cringe {
  padding: 30px 22px 34px;
  border-radius: var(--radius);
  background: rgba(20, 27, 61, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 207, 110, 0.18), 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.cringe-emoji {
  font-size: 72px;
  line-height: 1;
  margin: 6px 0 14px;
  animation: wobble 1.6s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg) scale(1.06); }
}

.cringe h2 {
  font-size: clamp(34px, 10vw, 48px);
}

.cringe p {
  margin: 14px 0 0;
  font-size: 18px;
}

.cringe p.en {
  margin-top: 4px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-dim);
}

.meter {
  margin: 22px auto 4px;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(6, 9, 24, 0.55);
  text-align: start;
  font-size: 14px;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  color: var(--cream-dim);
}

.meter-row b {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.meter-row b.is-broken {
  color: #ff5a6e;
  animation: shake 0.35s ease-in-out 3;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.meter-bar {
  height: 10px;
  margin: 6px 0 12px;
  border-radius: 6px;
  background: rgba(255, 243, 220, 0.12);
  overflow: hidden;
}

.meter-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ff5a6e);
}

.meter-row.love b {
  color: #ff5a6e;
  font-size: 18px;
}

.forgive {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.dodge-button {
  padding: 12px 22px;
  border: 1px solid rgba(255, 243, 220, 0.3);
  border-radius: 999px;
  background: rgba(6, 9, 24, 0.5);
  color: var(--cream-dim);
  touch-action: manipulation;
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.dodge-button.gave-up {
  border-color: var(--gold);
  color: var(--gold);
}
