/* ==================== RED LUXURY WHATSAPP THEME ==================== */
:root {
  --bg-deep: #0b141a;
  /* WhatsApp Dark BG equivalent */
  --bg-panel: #202c33;
  --crimson: #9f1239;
  --rose: #e11d48;
  --gold: #d4af37;
  --bubble-sent: #be123c;
  /* Red Sent Bubble */
  --bubble-received: #202c33;
  /* Dark Received Bubble */
  --text-main: #e9edef;
  --text-muted: #8696a0;

  --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.3);

  --font-display: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
}

html,
body {
  background: black;
  color: var(--text-main);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  height: 100%;
  height: -webkit-fill-available;
  overflow: hidden;
  position: fixed;
  /* Stop layout shifts */
  width: 100%;
  overscroll-behavior: none;
  /* Prevent iOS bounce */
}

/* ==================== LIVE BACKGROUND ==================== */
.ambient-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at top right, #3f0909 0%, #000000 60%);
}

#floatingHearts {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.floating-hearts-local {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

/* Hearts animation */
.floating-heart {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0;
  animation: floatUp 15s linear forwards;
  z-index: 5;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }

  10% {
    opacity: 0.8;
  }

  90% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

/* ==================== SECTIONS ==================== */
.section {
  position: absolute;
  inset: 0;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  filter: blur(20px);
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 1.2s cubic-bezier(0.4, 0, 0.2, 1),
              filter 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  background: transparent !important;
  /* Allow scrolling for vertically tall content */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.section > *:not([data-portrait-background]):not(.floating-hearts-local) {
  position: relative;
  z-index: 5;
}

/* Portrait background divs - cover entire section */
[data-portrait-background] {
  position: fixed !important; /* Use fixed to position relative to viewport */
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none !important; /* Remove from flex flow */
  z-index: 0 !important;
  pointer-events: none !important;
  opacity: 0 !important; /* Hidden by default */
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* Show portrait only when parent section is active */
.section.active [data-portrait-background] {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Ensure canvas inside portrait background is also properly positioned */
[data-portrait-background] canvas {
  display: block !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

.section.active {
  opacity: 1;
  transform: scale(1);
  filter: blur(0px);
  pointer-events: auto;
  z-index: 20;
}

.landing-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: transparent !important;
  z-index: 30;
}

/* ==================== LANDING ==================== */
.landing-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.animate-reveal {
  animation: fadeUp 0.8s ease forwards;
  opacity: 0;
}

.delay-1 {
  animation-delay: 0.2s;
}

.delay-2 {
  animation-delay: 0.4s;
}

.delay-3 {
  animation-delay: 0.6s;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== AUDIO PLAYER (Clean) ==================== */
.audio-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
}

#audioSection.audio-screen {
  --audio-screen-inline-pad: 1rem;
  --audio-control-size: 56px;
  --audio-middle-record-size: clamp(70px, 9vw, 86px);
  --audio-control-gap: clamp(0.7rem, 3vw, 0.95rem);
  justify-content: flex-start !important;
  background: #ffffff !important;
  padding: clamp(0.35rem, 1.2vh, 0.85rem) var(--audio-screen-inline-pad) 0;
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-gutter: auto;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
}

#audioSection.audio-screen [data-portrait-background] {
  z-index: 3 !important;
}

#audioSection.audio-screen .floating-hearts-local {
  position: absolute !important;
  inset: 0;
  z-index: 6;
}

#audioSection.audio-screen .audio-info-block {
  order: 1;
  text-align: center;
  margin-top: clamp(0.05rem, 0.4vh, 0.25rem);
  flex-shrink: 0;
  z-index: 10;
}

#audioSection.audio-screen .audio-info-title {
  font-family: 'Playfair Display';
  font-size: clamp(1.6rem, 4.5vw, 2rem);
  margin: 0 0 0.45rem;
  color: #222831;
}

#audioSection.audio-screen .audio-info-subtitle {
  color: #f3c955;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
}

#audioSection.audio-screen .audio-portrait-panel {
  order: 2;
  flex: 1 1 auto;
  min-height: clamp(120px, 22vh, 220px);
  max-height: none;
  width: min(92vw, 760px);
  margin: clamp(0.03rem, 0.18vh, 0.08rem) auto clamp(0.05rem, 0.25vh, 0.12rem);
  border-radius: clamp(22px, 4vw, 32px);
  background: transparent;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

#audioSection.audio-screen .audio-portrait-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 44%,
    rgba(255, 255, 255, 0.78) 72%,
    rgba(255, 255, 255, 1) 100%
  );
}

#audioSection.audio-screen .audio-bottom-area {
  order: 3;
  width: 100%;
  max-width: none;
  align-self: stretch;
  position: relative;
  z-index: 10;
  margin-top: 0;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 2.15rem);
}

#audioSection.audio-screen .audio-visualizer-full {
  display: block !important;
  position: relative !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 100vw !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  height: 52px;
  margin: 0 0 0.4rem;
}

#audioSection.audio-screen .audio-controls-safe {
  display: grid;
  grid-template-columns: var(--audio-control-size) var(--audio-middle-record-size) var(--audio-control-size);
  align-items: center;
  justify-content: center;
  column-gap: var(--audio-control-gap);
  row-gap: 0;
  padding: 0 1rem 0;
}

#audioSection.audio-screen .audio-controls-safe > * {
  width: var(--audio-control-size);
  height: var(--audio-control-size);
  box-sizing: border-box;
  margin: 0;
}

#audioSection.audio-screen .audio-record-shell {
  position: relative;
}

#audioSection.audio-screen .btn-play-lg,
#audioSection.audio-screen .btn-chat-lively,
#audioSection.audio-screen .audio-record-shell {
  width: var(--audio-control-size);
  height: var(--audio-control-size);
}

#audioSection.audio-screen .audio-record-shell .album-art {
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box;
  border-width: 5px !important;
  box-shadow: 0 8px 18px rgba(225, 29, 72, 0.24), 0 0 0 1px rgba(212, 175, 55, 0.2) inset;
}

#audioSection.audio-screen .audio-controls-safe .audio-record-shell {
  width: var(--audio-middle-record-size);
  height: var(--audio-middle-record-size);
}

#audioSection.audio-screen #playIcon,
#audioSection.audio-screen #pauseIcon {
  font-size: 27px !important;
}

#audioSection.audio-screen #chatBtnIcon {
  font-size: 24px !important;
}

@media (max-height: 760px) {
  #audioSection.audio-screen {
    --audio-control-size: 52px;
    --audio-middle-record-size: clamp(64px, 8.4vw, 76px);
    --audio-control-gap: clamp(0.58rem, 2.6vw, 0.78rem);
    padding-top: 0.35rem;
  }

  #audioSection.audio-screen .audio-info-title {
    font-size: clamp(1.35rem, 3.8vw, 1.7rem);
  }

  #audioSection.audio-screen .audio-portrait-panel {
    order: 2;
    flex: 1 1 auto;
    min-height: clamp(92px, 17vh, 160px);
    max-height: none;
    margin-top: 0.02rem;
    margin-bottom: 0.06rem;
  }

  #audioSection.audio-screen .audio-visualizer-full {
    height: 46px;
    margin-bottom: 0.35rem;
  }

  #audioSection.audio-screen .btn-play-lg,
  #audioSection.audio-screen .btn-chat-lively,
  #audioSection.audio-screen .audio-record-shell {
    width: var(--audio-control-size);
    height: var(--audio-control-size);
  }

  #audioSection.audio-screen .audio-controls-safe .audio-record-shell {
    width: var(--audio-middle-record-size);
    height: var(--audio-middle-record-size);
  }

  #audioSection.audio-screen #playIcon,
  #audioSection.audio-screen #pauseIcon {
    font-size: 25px !important;
  }

  #audioSection.audio-screen #chatBtnIcon {
    font-size: 23px !important;
  }

  #audioSection.audio-screen .audio-bottom-area {
    order: 3;
    margin-top: 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2.25rem);
  }
}

@media (max-width: 768px) {
  #audioSection.audio-screen {
    --audio-middle-record-size: clamp(68px, 20vw, 84px);
  }

  #audioSection.audio-screen .audio-info-block {
    margin-top: clamp(3.05rem, 0.4vh, 0.25rem);
  }

  #audioSection.audio-screen .audio-bottom-area {
    padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 3.15rem);
  }

  #audioSection.audio-screen .audio-visualizer-full {
    padding-bottom: 20px;
    box-sizing: border-box;
  }
}

.album-art-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

.album-art {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 12px solid #111;
  box-shadow: 0 0 50px rgba(225, 29, 72, 0.5);
  overflow: hidden;
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: spin 15s linear infinite paused;
  background: #000;
}

/* The vinyl record hole - must be ON TOP */
.album-art::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #050507;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.6);
  z-index: 10;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 0 15px rgba(212, 175, 55, 0.2);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1 !important;
  visibility: visible !important;
}

.album-art.playing {
  animation-play-state: running;
}

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

/* Floating Side-by-Side Controls */
.floating-controls-container {
  position: fixed;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 200;
  padding: 10px 20px;
  /* Only show when parent section is active */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.section.active .floating-controls-container {
  opacity: 1;
  pointer-events: auto;
}

.btn-play-lg {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--rose);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(225, 29, 72, 0.4);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-play-lg:active {
  transform: scale(0.95);
}

.btn-chat-lively {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  color: black;
  font-weight: bold;
  overflow: hidden;
  transition: transform 0.3s var(--ease-smooth), box-shadow 0.3s;
}

.btn-chat-lively:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.btn-chat-lively:active {
  transform: scale(0.95);
}

@keyframes breathingGlow {

  0%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
  }

  50% {
    opacity: 0.4;
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.8));
  }
}

.btn-chat-lively .material-symbols-outlined {
  animation: breathingGlow 3s ease-in-out infinite;
}

/* ==================== DEDICATED FULL-SCREEN CHAT ==================== */
.chat-section {
  padding: 0 !important;
  background: var(--bg-deep);
  z-index: 50;
  /* Override section default styles */
  justify-content: flex-start;
  align-items: stretch;
  /* IMPORTANT: Disable section scrolling for chat, use internal scrolling */
  overflow: hidden !important;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.chat-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: none;
  position: relative;
  overflow: hidden;
}

.chat-header {
  background: rgba(159, 18, 57, 1);
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 60;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Momentum scroll */
  padding: 20px 5%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  touch-action: pan-y;
  /* Prevent horizontal layout shifts */
}

.msg-bubble {
  max-width: 80%;
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  position: relative;
  font-size: 14.2px;
  line-height: 19px;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.msg-received {
  align-self: flex-start;
  background: rgba(225, 29, 72, 0.15);
  color: #e9edef;
  border-top-left-radius: 0;
}

.msg-received::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 8px solid rgba(225, 29, 72, 0.15);
  border-left: 8px solid transparent;
}

.msg-sent {
  align-self: flex-end;
  background: var(--bubble-sent);
  color: white;
  border-top-right-radius: 0;
}

.msg-sent::before {
  content: "";
  position: absolute;
  right: -8px;
  top: 0;
  width: 0;
  height: 0;
  border-top: 8px solid var(--bubble-sent);
  border-right: 8px solid transparent;
}

.time-stamp {
  float: right;
  margin-left: 10px;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.6;
  display: flex;
  gap: 4px;
}

.input-area {
  background: #202c33;
  padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.chat-input {
  flex: 1;
  background: #2a3942;
  border: none;
  border-radius: 20px;
  padding: 9px 12px;
  color: #d1d7db;
  font-size: 16px;
  /* 16px prevents iOS zoom on focus */
  outline: none;
}

.btn-send {
  background: var(--rose);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@keyframes bounceLively {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

/* Utils */
.hidden {
  display: none !important;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

/* Mini Record in Chat Header */
.mini-record-container {
  padding: 5px;
  cursor: pointer;
  transition: transform 0.2s;
}

.mini-record-container:active {
  transform: scale(0.9);
}

.mini-record {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid #111;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.4);
  overflow: hidden;
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: spin 8s linear infinite paused;
  background: #000;
}

.mini-record::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: #050507;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.5);
  z-index: 10;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.mini-record img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.mini-record.playing {
  animation-play-state: running;
}

/* ==================== LETTER ANIMATION ==================== */
@keyframes letterSlideUp {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0) rotate(var(--rotation, 0deg)) scale(0.2);
    filter: blur(15px) brightness(0.5);
  }
  
  10% {
    opacity: 0.6;
    transform: translateX(-50%) translateY(-50px) rotate(var(--rotation, 0deg)) scale(0.7);
    filter: blur(6px) brightness(1.2);
  }
  
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(-100px) rotate(var(--rotation, 0deg)) scale(1);
    filter: blur(3px) brightness(1.5);
  }
  
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-300px) rotate(var(--rotation, 0deg)) scale(1);
    filter: blur(3px) brightness(1.3);
  }
  
  65% {
    opacity: 0.95;
    transform: translateX(-50%) translateY(-450px) rotate(var(--rotation, 0deg)) scale(0.98);
    filter: blur(4px) brightness(1.2);
  }
  
  75% {
    opacity: 0.8;
    transform: translateX(-50%) translateY(-550px) rotate(var(--rotation, 0deg)) scale(0.95);
    filter: blur(5px) brightness(1);
  }
  
  82% {
    opacity: 0.6;
    transform: translateX(-50%) translateY(-650px) rotate(var(--rotation, 0deg)) scale(0.9);
    filter: blur(7px) brightness(0.9);
  }
  
  88% {
    opacity: 0.5;
    transform: translateX(-50%) translateY(-750px) rotate(var(--rotation, 0deg)) scale(0.85);
    filter: blur(9px) brightness(1.2);
  }
  
  92% {
    opacity: 0.4;
    transform: translateX(-50%) translateY(-820px) rotate(var(--rotation, 0deg)) scale(1.2);
    filter: blur(5px) brightness(2);
  }
  
  96% {
    opacity: 0.2;
    transform: translateX(-50%) translateY(-900px) rotate(var(--rotation, 0deg)) scale(2.5);
    filter: blur(20px) brightness(3);
  }
  
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-1000px) rotate(var(--rotation, 0deg)) scale(4);
    filter: blur(40px) brightness(0);
  }
}

.animated-letter {
  font-family: 'Playfair Display', serif;
  background: linear-gradient(135deg, #e11d48, #ec4899, #f472b6, #fbbf24);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px rgba(225, 29, 72, 0.6),
               0 0 100px rgba(236, 72, 153, 0.4),
               0 0 140px rgba(244, 114, 182, 0.2);
  filter: drop-shadow(0 0 40px rgba(225, 29, 72, 0.5));
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
