:root {
  --bg-deep: #0a0807;
  --gold: #F6C27A;
  --warm: #EAA372;
  --text-pure: #FAF5F0;
  --text-soft: #D4C3B3;
  --text-dim: #99877A;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  touch-action: none;
  background-color: var(--bg-deep);
  font-family: 'Tajawal', sans-serif;
  color: var(--text-pure);
}

/* =========================================
   Preloader & Audio Caching Screen
========================================= */
.preloader-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: #080605;
  background-image: radial-gradient(circle at 50% 40%, rgba(220, 110, 45, 0.14), transparent 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.8s cubic-bezier(0.2, 0.9, 0.3, 1), visibility 0.8s ease;
}

.preloader-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  max-width: 320px;
}

.circle-box {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 5;
}

.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.35s ease;
  filter: drop-shadow(0 0 10px rgba(246, 194, 122, 0.6));
}

.circle-box.spinning .progress-ring {
  animation: ringSpin 1.8s linear infinite;
}

@keyframes ringSpin {
  100% { transform: rotate(270deg); }
}

.ring-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--gold);
  pointer-events: none;
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
  50% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
}

.loader-status {
  font-family: 'Amiri', serif;
  font-size: 21px;
  color: var(--text-pure);
  margin-bottom: 6px;
  font-weight: 700;
}

.loader-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 22px;
}

.enter-btn {
  display: none;
  background: linear-gradient(135deg, rgba(246, 194, 122, 0.25), rgba(234, 163, 114, 0.4));
  border: 1px solid var(--gold);
  color: var(--text-pure);
  padding: 13px 32px;
  border-radius: 999px;
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(246, 194, 122, 0.35);
  animation: btnGlow 2s infinite ease-in-out;
  transition: transform 0.2s ease;
}

.enter-btn:active {
  transform: scale(0.96);
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(246, 194, 122, 0.25); }
  50% { box-shadow: 0 0 30px rgba(246, 194, 122, 0.6); }
}

/* =========================================
   Fullscreen Edge-to-Edge Experience
========================================= */
.hero-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  touch-action: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bg-artwork {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 1;
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.hero-fullscreen.holding .bg-artwork {
  transform: scale(1.03);
}

.warmth-bloom {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 60% 32%, rgba(255, 215, 140, 0.5) 0%, rgba(230, 115, 45, 0.25) 50%, transparent 80%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
  z-index: 2;
}

.hero-fullscreen.holding .warmth-bloom {
  opacity: 1;
}

.top-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;
  background: linear-gradient(180deg, rgba(10, 8, 7, 0.8) 0%, rgba(10, 8, 7, 0.3) 60%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

.bottom-scrim {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, 
    transparent 0%, 
    rgba(10, 8, 7, 0.35) 25%, 
    rgba(10, 8, 7, 0.85) 60%, 
    rgba(10, 8, 7, 0.98) 100%);
  pointer-events: none;
  z-index: 3;
}

.top-overlay {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 16, 13, 0.65);
  border: 1px solid rgba(246, 194, 122, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 500;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38D9A9;
  box-shadow: 0 0 10px #38D9A9;
  animation: livePulse 2s infinite ease-in-out;
}

@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 14px #38D9A9; }
}

.ambient-btn {
  background: rgba(20, 16, 13, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-soft);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: all 0.3s ease;
}

.ambient-btn.playing {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 14px rgba(246, 194, 122, 0.35);
}

.sound-wave {
  transition: opacity 0.3s ease;
}

.ambient-btn:not(.playing) .sound-wave {
  opacity: 0.2;
}

.cards-overlay {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 20px 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cards-container {
  width: 100%;
  min-height: 140px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.story-card {
  width: 100%;
  min-height: 140px;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  text-align: right;
  animation: cardFade 0.45s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.story-card.active {
  display: flex;
}

@keyframes cardFade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tag {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(246, 194, 122, 0.15);
  border: 1px solid rgba(246, 194, 122, 0.3);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.headline {
  font-family: 'Amiri', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-pure);
  line-height: 1.35;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.paragraph {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-soft);
  font-weight: 400;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.indicators-bar {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
}

.step-pill {
  width: 28px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: none;
  cursor: pointer;
  transition: all 0.35s ease;
}

.step-pill.active {
  width: 48px;
  background: var(--gold);
  box-shadow: 0 0 14px rgba(246, 194, 122, 0.6);
}

.whisper {
  font-family: 'Amiri', serif;
  font-size: 15px;
  color: var(--text-dim);
  font-style: italic;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: color 0.4s ease;
}

.hero-fullscreen.holding .whisper {
  color: var(--gold);
}
