:root {
  --night: #1b1220;
  --night-2: #261a2d;
  --plum: #3a2440;
  --cream: #f6ead8;
  --cream-dim: #cdbfae;
  --muted: #9a8a9c;
  --gold: #e3b16a;
  --rose: #e58a8a;
  --paper: #fbf6ee;
  --ink: #2a2226;
  --radius: 22px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --kufi: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
  --mono: "Courier Prime", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  background: radial-gradient(circle at 50% -10%, var(--plum), var(--night) 60%) fixed,
    var(--night);
  color: var(--cream);
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Ambient background */
.glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.glow-one {
  background: var(--rose);
  top: -140px;
  right: -160px;
}

.glow-two {
  background: var(--gold);
  bottom: -180px;
  left: -160px;
  opacity: 0.2;
}

.notes span {
  position: fixed;
  bottom: -40px;
  color: var(--gold);
  opacity: 0;
  font-size: 22px;
  pointer-events: none;
  animation: float-note 14s linear infinite;
  z-index: 0;
}

.notes span:nth-child(1) { left: 8%; animation-delay: 0s; }
.notes span:nth-child(2) { left: 24%; animation-delay: 3s; font-size: 16px; }
.notes span:nth-child(3) { left: 46%; animation-delay: 6s; }
.notes span:nth-child(4) { left: 64%; animation-delay: 1.5s; font-size: 18px; }
.notes span:nth-child(5) { left: 80%; animation-delay: 8s; }
.notes span:nth-child(6) { left: 92%; animation-delay: 4.5s; font-size: 14px; }

@keyframes float-note {
  0% { transform: translateY(0) rotate(0); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-110vh) rotate(25deg); opacity: 0; }
}

/* Scenes */
main {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 76px 16px 64px;
}

.scene {
  display: none;
}

.scene.is-active {
  display: block;
  animation: scene-in 0.7s 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.18em;
  text-transform: uppercase;
}

/* Buttons */
.play-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 15px 30px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: var(--night);
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 12px 30px rgba(229, 138, 138, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(229, 138, 138, 0.42);
}

.play-button.small {
  margin-top: 0;
  padding: 12px 24px;
  font-size: 15px;
}

.play-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--night);
  color: var(--gold);
  font-size: 11px;
  padding-left: 2px;
}

.ghost-button {
  padding: 11px 18px;
  border: 1px solid rgba(246, 234, 216, 0.22);
  border-radius: 999px;
  background: transparent;
  color: var(--cream);
  transition: background 0.2s ease;
}

.ghost-button:hover:not(:disabled) {
  background: rgba(246, 234, 216, 0.08);
}

.ghost-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.ghost-button.wide {
  display: block;
  margin: 24px auto 0;
}

/* 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(246, 234, 216, 0.2);
  border-radius: 50%;
  background: rgba(27, 18, 32, 0.7);
  backdrop-filter: blur(8px);
}

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

.bars i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
  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;
  height: 3px;
  opacity: 0.6;
}

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

.bars i {
  transform-origin: bottom;
}

/* Vinyl */
.vinyl {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 31%, rgba(255, 255, 255, 0.05) 31.5% 32%, transparent 32.5%),
    repeating-radial-gradient(circle, #141015 0 2px, #1d181f 2px 4px),
    #141015;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 6px #0e0b0f;
}

.vinyl::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 30deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.09) 40deg,
    transparent 80deg,
    transparent 180deg,
    rgba(255, 255, 255, 0.06) 220deg,
    transparent 260deg
  );
}

.vinyl-label {
  position: absolute;
  inset: 34%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, var(--night) 0 6%, transparent 6.5%),
    linear-gradient(135deg, var(--gold), var(--rose));
}

.vinyl-label span {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 6vw, 30px);
  color: var(--night);
  transform: translateY(-34%);
}

.vinyl.is-spinning {
  animation: spin 3.2s linear infinite;
}

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

/* Cover */
.cover {
  text-align: center;
  /* A spinning square box grows past its edges; clip it without a scrollbar. */
  overflow-x: clip;
}

.cover-art {
  position: relative;
  width: min(260px, 62vw);
  aspect-ratio: 1;
  margin: 0 auto 36px;
}

.vinyl-peek {
  position: absolute;
  inset: 4%;
  animation: peek-in 1.4s 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both, spin 12s 1.7s linear infinite;
}

/* translate is separate from transform, so the slide-out and spin can stack. */
@keyframes peek-in {
  from { translate: 0 0; }
  to { translate: 30% 0; }
}

.sleeve {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 75% 20%, rgba(227, 177, 106, 0.45), transparent 55%),
    radial-gradient(circle at 20% 85%, rgba(229, 138, 138, 0.5), transparent 55%),
    linear-gradient(160deg, #4a2c4f, #23172a);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  text-align: left;
  transform: translateX(-16%);
}

.sleeve-small {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.sleeve-ar {
  margin: 0;
  font-family: var(--kufi);
  font-size: clamp(40px, 13vw, 60px);
  line-height: 1;
  text-align: right;
  color: var(--cream);
}

.sleeve-en {
  margin: -8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(30px, 10vw, 44px);
  line-height: 1;
  color: var(--gold);
  text-align: right;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 11vw, 56px);
  line-height: 1.05;
}

h1 em {
  color: var(--gold);
}

.title-ar {
  font-family: var(--kufi);
  font-size: clamp(44px, 13vw, 64px);
  line-height: 1.2;
}

.title-ar em {
  font-style: normal;
}

.title-en {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--rose);
}

.cover-copy {
  margin: 18px auto 0;
  max-width: 400px;
  font-size: 18px;
  color: var(--cream);
}

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

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* Player */
.player {
  padding: 26px 22px 24px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(58, 36, 64, 0.65), rgba(38, 26, 45, 0.85));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  text-align: center;
}

.deck {
  position: relative;
  width: min(230px, 62vw);
  margin: 0 auto 26px;
}

.tonearm {
  position: absolute;
  top: -10px;
  right: -14px;
  width: 10px;
  height: 58%;
  border-radius: 6px;
  background: linear-gradient(90deg, #cfc4b6, #8f8478);
  transform-origin: 50% 8px;
  transform: rotate(-30deg);
  transition: transform 0.9s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.tonearm::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #bdb2a5;
}

.tonearm::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: -4px;
  width: 18px;
  height: 22px;
  border-radius: 4px;
  background: var(--gold);
}

.tonearm.is-down {
  transform: rotate(14deg);
}

.now-playing h2 {
  margin: 0;
  font-family: var(--kufi);
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.3;
}

.now-playing h2:lang(en),
.now-playing h2[dir="auto"] {
  font-family: var(--kufi), var(--serif);
}

.track-subtitle {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--cream-dim);
}

.lyrics {
  margin: 22px 0 18px;
  padding: 20px 18px;
  border-radius: 16px;
  background: rgba(14, 10, 16, 0.4);
  min-height: 200px;
  text-align: start;
}

.lyrics p {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.75;
  opacity: 0;
  animation: line-in 0.8s ease forwards;
}

.lyrics p:last-child {
  margin-bottom: 0;
  color: var(--gold);
}

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

.progress {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.progress span {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: rgba(246, 234, 216, 0.14);
  transition: background 0.4s ease;
}

.progress span.is-done {
  background: linear-gradient(90deg, var(--gold), var(--rose));
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

/* Tracklist */
.tracklist {
  list-style: none;
  margin: 26px 0 0;
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(38, 26, 45, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.tracklist button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--cream);
  text-align: start;
}

.tracklist button:hover:not(:disabled) {
  background: rgba(246, 234, 216, 0.06);
}

.tracklist button:disabled {
  cursor: default;
  color: var(--muted);
}

.tracklist button.is-current {
  background: rgba(227, 177, 106, 0.14);
  color: var(--gold);
}

.tl-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.is-current .tl-num {
  color: var(--gold);
}

.tl-title {
  font-size: 15px;
  text-align: left;
}

.tl-time {
  font-size: 13px;
  color: var(--rose);
}

/* Letter */
.letter {
  padding: 34px 26px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.letter .eyebrow {
  color: #b5734f;
}

.letter h2 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(32px, 9vw, 42px);
}

.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-strong {
  font-family: var(--kufi);
  font-size: 22px !important;
  color: #b5536a;
}

.letter-sign {
  margin-top: 22px !important;
  text-align: end;
  font-size: 22px !important;
}

.letter .play-button {
  margin-top: 18px;
}

/* Receipt */
.receipt {
  position: relative;
  max-width: 380px;
  margin: 0 auto;
  padding: 30px 22px 26px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  animation: print 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transform-origin: top;
  --zig: radial-gradient(circle at 8px 0, transparent 7px, var(--paper) 7.5px);
}

.receipt::before,
.receipt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: var(--zig);
  background-size: 16px 10px;
}

.receipt::before {
  top: -9px;
  transform: rotate(180deg);
}

.receipt::after {
  bottom: -9px;
}

@keyframes print {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-20px); }
  to { clip-path: inset(-20px 0 -20px 0); transform: none; }
}

.receipt-head {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 2px dashed rgba(42, 34, 38, 0.35);
}

.receipt-head p {
  margin: 0;
}

.receipt-head p[dir] {
  margin-top: 6px;
  font-family: var(--sans);
  font-weight: 600;
}

.receipt-shop {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.receipt-meta {
  margin-top: 4px !important;
  font-size: 12px;
  color: #7a6d70;
}

.receipt-items {
  list-style: none;
  margin: 0;
  padding: 14px 0;
  border-bottom: 2px dashed rgba(42, 34, 38, 0.35);
}

.receipt-items li,
.receipt-total p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 5px 0;
}

.receipt-items span,
.receipt-total b[dir] {
  font-family: var(--sans);
}

.receipt-items b {
  white-space: nowrap;
}

.receipt-total {
  padding-top: 12px;
}

.receipt-total .grand {
  margin: 8px 0;
  padding: 10px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.receipt-total .grand b {
  color: #b5536a;
  text-align: end;
}

.barcode {
  height: 54px;
  margin: 20px 10px 10px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 4px,
    var(--ink) 4px 5px,
    transparent 5px 8px,
    var(--ink) 8px 11px,
    transparent 11px 13px
  );
}

.receipt-foot {
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.play-button.centered {
  display: flex;
  margin: 28px auto 0;
}

/* Promise */
.promise {
  position: relative;
  padding: 40px 24px 34px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 0%, rgba(229, 138, 138, 0.35), transparent 60%),
    linear-gradient(180deg, rgba(58, 36, 64, 0.85), rgba(27, 18, 32, 0.95));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(227, 177, 106, 0.25);
  text-align: center;
  overflow: hidden;
}

.promise-title {
  margin: 0 0 24px;
  font-family: var(--kufi);
  font-size: clamp(34px, 10vw, 44px);
  line-height: 1.3;
}

.vows {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: vow;
}

.vows li {
  position: relative;
  margin: 0 0 14px;
  padding: 16px 18px 14px;
  border-radius: 16px;
  background: rgba(14, 10, 16, 0.45);
  box-shadow: inset 0 0 0 1px rgba(246, 234, 216, 0.06);
  opacity: 0;
  animation: line-in 0.9s ease forwards;
}

.vows li:nth-child(1) { animation-delay: 0.4s; }
.vows li:nth-child(2) { animation-delay: 1.3s; }
.vows li:nth-child(3) { animation-delay: 2.2s; }
.vows li:nth-child(4) { animation-delay: 3.1s; }
.vows li:nth-child(5) { animation-delay: 4s; }

.vows li::before {
  counter-increment: vow;
  content: "♡";
  display: block;
  margin-bottom: 4px;
  color: var(--rose);
  font-size: 18px;
}

.vows p {
  margin: 0;
  font-size: 17px;
  line-height: 1.75;
}

.vows .vow-en {
  margin-top: 4px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold);
  font-size: 16px;
}

.promise-final {
  margin: 30px 0 0;
  font-family: var(--kufi);
  font-size: clamp(46px, 14vw, 64px);
  line-height: 1.25;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  animation: love-in 1.4s 5.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes love-in {
  from { opacity: 0; transform: scale(0.8); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: none; }
}

.promise-sign {
  margin: 6px 0 0;
  font-family: var(--kufi);
  font-size: 22px;
  color: var(--cream-dim);
  opacity: 0;
  animation: line-in 1s 6.2s ease forwards;
}

.promise-hearts span {
  position: absolute;
  bottom: -30px;
  color: var(--rose);
  opacity: 0;
  font-size: 20px;
  animation: float-note 7s linear infinite;
  animation-delay: 5.4s;
}

.promise-hearts span:nth-child(1) { left: 6%; }
.promise-hearts span:nth-child(2) { left: 20%; animation-delay: 6.4s; font-size: 14px; }
.promise-hearts span:nth-child(3) { left: 36%; animation-delay: 7.6s; }
.promise-hearts span:nth-child(4) { left: 52%; animation-delay: 5.9s; font-size: 16px; }
.promise-hearts span:nth-child(5) { left: 68%; animation-delay: 8.2s; }
.promise-hearts span:nth-child(6) { left: 82%; animation-delay: 6.9s; font-size: 14px; }
.promise-hearts span:nth-child(7) { left: 92%; animation-delay: 7.2s; }

/* Laptop: vinyl beside the words, tracklist beside the player. */
@media (min-width: 900px) {
  main {
    max-width: 1100px;
    padding-top: 64px;
  }

  .cover,
  .letter,
  .promise {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
  }

  #player-scene.is-active {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }

  .player {
    display: grid;
    grid-template-columns: 260px 1fr;
    column-gap: 36px;
    align-items: center;
    padding: 32px;
  }

  .deck {
    grid-row: 1 / span 5;
    width: 260px;
    margin: 0;
  }

  .player > :not(.deck) {
    grid-column: 2;
  }

  .tracklist {
    margin-top: 0;
  }
}

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

/* Hidden YouTube player: kept rendered (not display:none) so it can play. */
.yt-holder {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 200px;
  height: 113px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.song-credit {
  margin: -6px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

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