/* ADDED: Cloud Background Styling */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #68bbf3 0%, #a4e0f5 100%);
    overscroll-behavior: none;
}

#scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; 
    outline: none;
    pointer-events: none;
}

/* 1. The Screen Frame */
.rosary-prayer {
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; 
  position: relative;
}

/* 2. The "Canvas" Box */
.overlay {
  position: relative; 
  aspect-ratio: 4961 / 3508;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
}

/* 3. The SVGs inside */
.overlay svg {
  position: absolute; 
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block; 
  overflow: visible; 
}

/* HOVER EFFECTS FOR BEADS */
.HailMaryBeads ellipse {
  pointer-events: visiblePainted;            
  filter: none;                              
  transition: filter .15s ease-in-out;       
}

.HailMaryBeads ellipse:hover {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 8px gold);
}

.HailMaryBeads {
  z-index: 200;
  pointer-events: none;
}

.GloryBeChain {
  z-index: 100;
}
.GloryBeChain path {
  pointer-events: visiblePainted;            
  filter: none;                              
  transition: filter .15s ease-in-out;       
}

.GloryBeChain path[id^="PrayerChain"]:hover {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 8px gold);
}

/* Disables hover state entirely when Chaplet mode is active */
body.chaplet-mode .GloryBeChain path {
  pointer-events: none; 
}

.OurFatherBeads {
  z-index: 200;
  pointer-events: none;
}
.OurFatherBeads ellipse {
  pointer-events: visiblePainted;            
  filter: none;                              
  transition: filter .15s ease-in-out;       
}
.OurFatherBeads ellipse:hover {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 8px gold);
}

.SalveReginaHeart {
  z-index: 200;
  pointer-events: none;
}
.SalveReginaHeart path {
  pointer-events: visiblePainted;            
  filter: none;                              
  transition: filter .15s ease-in-out;       
}
.SalveReginaHeart path:hover {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 8px gold);
}

.ApostlesCreedCross {
  z-index: 200;
  pointer-events: none;
}
.ApostlesCreedCross path {
  pointer-events: visiblePainted;            
  filter: none;                              
  transition: filter .15s ease-in-out;       
}
.ApostlesCreedCross path:hover {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 8px gold);
}

/* POPUP MODAL STYLES */
.popup {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.popup.hidden {
  display: none;
}

/* The Fixed Container (with Gradients) */
.popup-inner {
  background: #111;
  color: #fff;
  border-radius: 12px;
  width: min(650px, 65vw);  
  max-height: 80vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  font-size: 1rem;
  line-height: 1.4;
  position: relative; 
  overflow: hidden; 
  
  /* Flexbox forces the inner container to recognize boundaries */
  display: flex;
  flex-direction: column;
}

/* Top Black-to-Transparent Gradient */
.popup-inner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1.5rem; 
  background: linear-gradient(to bottom, #111 10%, transparent 100%);
  z-index: 10;
  pointer-events: none; 
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* Bottom Black-to-Transparent Gradient */
.popup-inner::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1.5rem; 
  background: linear-gradient(to top, #111 10%, transparent 100%);
  z-index: 10;
  pointer-events: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* The Scrolling Wrapper */
.popup-scroll {
  padding: 1rem 3.5rem; /* Expanded padding to fit the left/right buttons */
  overflow-y: auto; 
  
  /* Tells the scroll container to fill available space but shrink when needed */
  flex: 1;
  min-height: 0;
  
  /* Hides the scrollbar for IE, Edge and Firefox */
  -ms-overflow-style: none;  
  scrollbar-width: none;  
}

/* Hides the scrollbar for Chrome, Safari and Opera */
.popup-scroll::-webkit-scrollbar {
  display: none; 
}

#popup-text p {
  margin: 0 0 0.75rem 0; 
}
#popup-text p:last-child {
  margin-bottom: 0;
}

.popup-title {
  text-align: center;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

/* NAVIGATION BUTTON STYLES */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 2rem;
  cursor: pointer;
  z-index: 20;
  padding: 10px;
  transition: color 0.2s ease, transform 0.1s ease;
  outline: none;
}

.nav-btn:hover {
  color: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
}

.nav-btn:active {
  transform: translateY(-50%) scale(0.9);
}

.prev-btn { left: 5px; }
.next-btn { right: 5px; }

/* SETTINGS BUTTON */
.settings-button {
  position: absolute;
  top: 5%;
  right: 5%; 
  width: auto;
  padding: 0;
  background: transparent; /* Makes the button block invisible */
  border: none;
  cursor: pointer;
  z-index: 300;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, filter 0.2s;
}

/* Apply the glow to the SVG shape rather than the button container */
.settings-button svg {
  filter: 
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.1))
    drop-shadow(0 0 15px rgba(255, 255, 255, 0.25))
    drop-shadow(0 0 25px rgba(255, 255, 255, 0.15));
  transition: filter 0.2s ease;
}

.settings-button:hover {
   transform: scale(1.05);
}

.settings-button:hover svg {
  filter: invert(48%) sepia(90%) saturate(800%) hue-rotate(10deg) brightness(1.4) drop-shadow(0 0 0px gold);
}

.settings-button:active {
  transform: scale(0.95);
}

/* Apply the glow and prevent the SVG from stretching to 100% of the screen */
.settings-button svg {
  position: static;      /* Overrides the absolute positioning from .overlay svg */
  width: 45px;           /* Overrides the 100% width */
  height: 45px;          /* Overrides the 100% height */
  
  filter: 
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.1))
    drop-shadow(0 0 15px rgba(255, 255, 255, 0.25))
    drop-shadow(0 0 25px rgba(255, 255, 255, 0.15));
  transition: filter 0.2s ease;
}

/* MENU OVERLAY STYLES */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.menu-box {
  background: #111;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(350px, 80vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 25px rgba(0,0,0,0.75);
  
  /* Hides the scrollbar for the menu too */
  -ms-overflow-style: none;  
  scrollbar-width: none;  
}

.menu-box::-webkit-scrollbar {
  display: none;
}

.menu-section-header {
  color: #ddd;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.25rem;
}

.menu-section-header:first-child {
  margin-top: 0;
}

.menu-item {
  background: #1a1a1a;
  color: white;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.menu-item:hover {
  background: #2a2a2a;
  border-color: #555;
}

/* --- SETTINGS VOLUME SLIDER --- */
.volume-container {
  padding: 0.5rem 0.8rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.volume-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}

/* Chrome, Safari, Edge */
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgb(204, 153, 12);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(204, 153, 12, 0.5);
}

/* Firefox */
.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgb(204, 153, 12);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(204, 153, 12, 0.5);
  border: none;
}

/* Labels on the rosary beads */
.apostlesCreed, 
.title, 
.first-father,
.Hailmary-3,
.GloryBe,
.Mystery-1
{
  font-weight: 500;
  padding: 0.4cqh 0.6cqw;
  border-radius: 25px;
  background: rgb(204, 153, 12);
  color: white;
  box-shadow:
    0 0 0.6cqw rgba(204, 153, 12, 0.5),
    0 0 1.2cqw rgba(182, 142, 9, 0.35);
}

.apostlesCreed {
  position: absolute;
  top: 46.5%;
  right: 37%;
  font-size: clamp(1px, 1.25cqw, 20px);
} 
.first-father {
  position: absolute;
  top: 40.5%;
  right: 39.5%;
  font-size: clamp(1px, 1.25cqw, 20px);
}
.Hailmary-3 {
  position: absolute;
  top: 31%;
  right: 37.5%;
  font-size: clamp(1px, 1.25cqw, 20px);
}
.GloryBe {
  position: absolute;
  top: 25.75%;
  right: 37%;
  font-size: clamp(1px, 1.25cqw, 20px);
}
.Mystery-1 {
  position: absolute;
  top: 22.5%;
  right: 39.25%;
  font-size: clamp(1px, 1.25cqw, 20px);
}
.title {
  position: absolute;
  right: 2%;
  bottom: 2%;
  font-size: clamp(10px, 2.6cqw, 18px);
}