/* 🌿 Body Styling */
body {
  background: url("images/cabinet-kitchen.png") no-repeat center center fixed;
  background-size: cover;
  font-family: 'Georgia', serif;
  color: #2e7d32;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.elegant-title {
  text-align: center;
  margin-top: 30px;
  font-family: 'Cinzel', 'Georgia', serif;
}

.title-main {
  display: block;
  font-size: .75em;
  color: #ffd800;
  font-weight: normal;
  text-shadow: 
    2px 2px 0px #b8941f,
    4px 4px 0px rgba(0,0,0,0.3),
    0 0 20px rgba(212, 175, 55, 0.5),
    0 0 40px rgba(212, 175, 55, 0.3);
  letter-spacing: 3px;
  margin-bottom: 10px;
}

.title-sub {
  display: block;
  font-size: 1.2em;
  color: #b2ec5d;
  font-weight: bold;
  text-shadow: 
    1px 1px 0px #81c784,
    2px 2px 0px rgba(0,0,0,0.3),
    0 0 15px rgba(165, 214, 167, 0.6);
  letter-spacing: 2px;
  font-style: italic;
}

/* 🌿 Headings */
h1 {
  text-align: center;
  margin-top: 20px;
  color: #d4e83b;
  font-weight: bold;
  font-family: 'Brush Script MT', cursive;
  font-size: 60px;
  -webkit-text-stroke: 1px black;
}

h2 {
  text-align: center;
  margin-top: 15px;
  color: #d4e83b;
  font-weight: bold;
  font-size: 35px;
  -webkit-text-stroke: 1px black;
}

h3, span {
  text-align: center;
  margin-top: 10px;
  color: #d4e83b;
  font-weight: bold;
  font-size: 25px;
  -webkit-text-stroke: 1px black;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6), 1px 1px 3px rgba(255, 255, 255, 0.7);
}

p, span {
  text-align: center;
  margin-top: 10px;
  color: #fff;
  font-weight: bold;
  font-size: 25px;
  -webkit-text-stroke: 0.5px black;
}

/* 🌿 Brighter Question Text */
#questionContainer p {
  color: #ffffff !important;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 255, 255, 0.5);
  font-size: 28px;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 10px;
  margin: 20px 0;
}

/* 🌿 Herb Scroll Styling */
#herbScroll {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 10px;
  margin-top: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* 🌿 Buttons */
button {
  display: block;
  margin: 15px auto;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 1.5em;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

/* 🌿 Level Button States */
.unlocked {
  background: #a5d6a7;
  box-shadow: 0 0 12px #81c784;
}

.locked {
  background: #ccc;
  cursor: not-allowed;
}

/* 🌿 Answer Buttons */
.answerBtn {
  background: #e8f5e9;
  border: 2px solid #81c784;
  margin: 5px;
  font-size: 20px;
}

.answerBtn:hover {
  background: #c8e6c9;
  box-shadow: 0 0 8px #66bb6a;
}

/* 🌿 Question Container */
#questionContainer {
  font-size: 30px;
  text-align: center;
  color: #000;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  margin-bottom: 20px;
}

/* 🌿 Jar Animation */
#jarAnimation {
  font-size: 2em;
  text-align: center;
  animation: floatIn 2s ease-out;
  color: #d4e83b;
}

/* 🌿 Float In Animation */
@keyframes floatIn {
  0% { transform: translateY(100px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* 🌿 Level-specific Jars */
.levelJar {
  width: 100px;
  height: 120px;
  margin: 20px auto;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  animation: float 3s ease-in-out infinite;
}

/* 🌿 Different jar images for each level */
.jar-0 { background-image: url("images/jar1.png"); }
.jar-1 { background-image: url("images/jar2.png"); }
.jar-2 { background-image: url("images/jar3.png"); }
.jar-3 { background-image: url("images/jar4.png"); }
.jar-4 { background-image: url("images/jar5.png"); }
.jar-5 { background-image: url("images/jar6.png"); }
.jar-6 { background-image: url("images/jar7.png"); }
.jar-7 { background-image: url("images/jar8.png"); }
.jar-8 { background-image: url("images/jar9.png"); }
.jar-9 { background-image: url("images/jar10.png"); }
.jar-10 { background-image: url("images/jar11.png"); }
.jar-11 { background-image: url("images/jar12.png"); }

/* 🌿 Cabinet Layout */
#cabinetJars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
  gap: 15px;
}

/* 🌿 Better Jar Styling for Cabinet */
.cabinetJar {
  width: 120px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sparkle 2s infinite;
  text-align: center;
  font-size: 0.9em;
  color: #2e7d32;
  transition: all 0.3s ease;
  cursor: pointer;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

.cabinetJar:hover {
  transform: scale(1.1);
  filter: brightness(1.7);
}

.cabinetJar span {
  background: rgba(255, 255, 255, 0.8);
  padding: 5px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: bold;
}

/* 🌿 Sparkle Animation */
@keyframes sparkle {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

/* 🌿 Wrong Answer Animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* 🌿 Level Complete Screen (Simple Green Theme) */
#levelCompleteScreen {
  text-align: center;
  background: linear-gradient(135deg, #1b5e20, #2e7d32, #4caf50);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.level-complete-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 40px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

#celebrationTitle {
  font-size: 3em;
  color: gold;
  font-weight: bold;
  text-shadow: 0 0 20px yellow;
  animation: textPulse 2s ease-in-out infinite;
  margin-bottom: 20px;
}

#celebrationSubtitle {
  font-size: 1.8em;
  color: #e8f5e9;
  font-weight: bold;
  text-shadow: 0 0 10px #a5d6a7;
  margin-bottom: 30px;
}

#levelNameSpan {
  color: gold;
  text-shadow: 0 0 10px yellow;
}

.preparationText {
  font-size: 1.3em;
  color: #e8f5e9;
  margin-top: 30px;
  animation: fadeInOut 2s ease-in-out infinite;
}

/* 🌿 Falling Leaves and Flowers for Level Complete */
.fallingLeaf {
  position: fixed;
  font-size: 2em;
  animation: fallLeaf linear infinite;
  z-index: 1;
  pointer-events: none;
  opacity: 0.8;
}

.fallingFlower {
  position: fixed;
  font-size: 1.8em;
  animation: fallFlower linear infinite;
  z-index: 1;
  pointer-events: none;
  opacity: 0.9;
}

.sparkle {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  animation: sparkleTwinkle 2s ease-in-out infinite;
}

@keyframes fallLeaf {
  0% {
    transform: translateY(-100px) translateX(0px) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% {
    transform: translateY(100vh) translateX(50px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes fallFlower {
  0% {
    transform: translateY(-100px) translateX(0px) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% {
    transform: translateY(100vh) translateX(-30px) rotate(-360deg);
    opacity: 0;
  }
}

@keyframes sparkleTwinkle {
  0%, 100% { 
    opacity: 0; 
    transform: scale(0.5) rotate(0deg);
  }
  50% { 
    opacity: 1; 
    transform: scale(1.2) rotate(180deg);
  }
}

@keyframes textPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* 🌿 Grand Finale Screen (Rainbow Spectacular) */
/* 🌿 SPECTACULAR Grand Finale - FIXED */

#grandFinale {
  text-align: center;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
  background-size: 400% 400%;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: rainbowBackground 8s ease infinite;
  overflow: hidden; /* Important for falling elements */
}

/* 🌿 Fixed Falling Elements */
.fallingLeaf, .fallingFlower {
  position: absolute; /* Changed from fixed */
  font-size: 2em;
  animation: grandFall linear infinite;
  z-index: 1001;
  pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.8));
  top: -100px; /* Start above screen */
}

.confetti {
  position: absolute; /* Changed from fixed */
  width: 12px;
  height: 12px;
  animation: confettiFall linear infinite;
  z-index: 1002;
  pointer-events: none;
}

/* 🌿 Fixed Animations */
@keyframes grandFall {
  0% {
    transform: translateY(-100px) translateX(0px) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) translateX(100px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

@keyframes rainbowBackground {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 🌿 Fixed Text Positioning */
.celebration-content {
  position: relative;
  z-index: 1003;
  text-align: center;
  margin-bottom: 100px; /* Space between text and jars */
}

#congratulationsText {
  font-size: 4em;
  color: white;
  font-weight: bold;
  text-shadow: 
    0 0 20px rgba(255,255,255,0.8),
    0 0 30px rgba(255,215,0,0.6),
    0 0 40px rgba(255,165,0,0.4);
  animation: grandTextPulse 2s ease-in-out infinite;
  margin-bottom: 20px;
}

#subtitleText {
  font-size: 2.5em;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255,255,255,0.8);
  animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes grandTextPulse {
  0%, 100% { 
    transform: scale(1);
    text-shadow: 0 0 20px rgba(255,255,255,0.8);
  }
  50% { 
    transform: scale(1.1);
    text-shadow: 0 0 40px white, 0 0 30px gold, 0 0 50px orange;
  }
}

/* 🌿 Fixed Rotating Jars Container */
#rotatingJarsContainer {
  position: relative;
  width: 500px;
  height: 500px;
  margin: 0 auto;
  z-index: 1002;
}

/* Simple rotation for troubleshooting */
@keyframes simpleRotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.simpleRotatingJar {
  filter: drop-shadow(0 0 10px gold);
}

/* 🌿 Grand Finale Buttons */
/* 🌿 Vertical Stack Buttons - Best Compatibility */
.finale-buttons {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1003;
    width: 90%;
    max-width: 300px;
}

.finale-buttons button {
    padding: 15px 20px;
    font-size: 1.1em;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.finale-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* 🌿 Animated Audio Status */
#audioStatus {
  color: #ff6b6b;
  font-size: 0.9em;
  animation: pulseWarning 2s ease-in-out infinite;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
  padding: 5px 10px;
  border-radius: 5px;
  background: rgba(255, 107, 107, 0.1);
}


@keyframes pulseWarning {
  0%, 100% { 
    transform: scale(1);
    background: rgba(255, 107, 107, 0.9);
  }
  50% { 
    transform: scale(1.02);
    background: rgba(255, 68, 68, 0.95);
  }
}

/* 🌿 Mobile Responsive Design */
@media (max-width: 768px) {
    /* Stack buttons vertically on mobile */
    #mainMenu button {
        display: block !important;
        margin: 10px auto !important;
        width: 90% !important;
        max-width: 300px !important;
    }
    
    /* Make text larger on mobile */
    #mainMenu {
        font-size: 18px;
    }
    
    /* Center and stack donation buttons */
    .donation-buttons {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .donation-buttons button {
        margin: 5px 0 !important;
        width: 80% !important;
    }
}

/* 🌿 Mobile Responsive */
.main-btn {
    background: linear-gradient(45deg, #4CAF50, #2E7D32);
    color: white;
    padding: 18px 35px;
    font-size: 1.4em;
    margin: 0 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    display: inline-block;
}

.donate-btn {
    background: linear-gradient(45deg, #4CAF50, #2E7D32);
    color: white;
    padding: 16px 28px;
    margin: 0 10px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: bold;
    display: inline-block;
}

/* Mobile styles */
@media (max-width: 768px) {
    .button-row {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .main-btn {
        display: block !important;
        margin: 10px 0 !important;
        width: 90%;
        max-width: 300px;
    }
    
    .donation-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .donate-btn {
        display: block !important;
        margin: 8px 0 !important;
        width: 80%;
    }
    
    /* Make text larger on mobile */
    body {
        font-size: 18px;
    }
}