body, html {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  height: 100%;
  width: 100%;
  overflow-x: hidden; /* only block sideways scroll */
}

#imageContainer {
  padding: 140px 20px 40px 20px; /* top | right | bottom | left */
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* New animation for task images */
@keyframes imageBounceIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Apply animation to task images */
.task-image {
  width: 6.98cm;
  height: 5.39cm;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: imageBounceIn 0.3s ease-out;
  transition: transform 0.2s ease;
}

.task-image:hover {
  transform: scale(1.05);
}

.main-screen, .energy-screen {
  background: url('background.jpg') no-repeat center center fixed;
  background-size: cover;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 40px;
  padding-top: 140px; /* space for Home button */
  padding-bottom: 40px;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.bubble {
  width: 5cm;
  height: 5cm;
  border-radius: 50%;
  flex-shrink: 0; /* prevent squishing */
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30px;
  color: #F4EDE0;
  cursor: pointer;
  animation: floatBounce 2.5s ease-in-out infinite;
  text-align: center;
  transition: transform 0.3s;
  opacity: 0;
  animation: flyInFromTop 1s ease-out forwards;
}

.bubble:hover {
  transform: scale(1.05);
}

#exercise {
  background: rgba(138, 157, 128, 0.8);
}

#food {
  background: rgba(182, 165, 179, 0.8);
}

#mental {
  background: rgba(205, 150, 140, 0.8);
}

#report {
  background: rgba(129, 170, 202, 0.8); 
}

.energy-bubble {
  width: 5cm;
  height: 5cm;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: flyInFromBottom 0.5s ease-out forwards;
  opacity: 0;
}

#highEnergy {
  background-color: rgba(138, 157, 128, 0.8);
}

#lowEnergy {
  background-color: rgba(205, 150, 140, 0.8);
}

.energy-bubble img {
  z-index: 2;
  cursor: pointer;
  pointer-events: auto;
}

.high-icon {
  width: 3.5cm;
  height: 4.39cm;
  object-fit: contain;
  opacity: 0;
}

.low-icon {
  width: 3.5cm;
  height: 4.64cm;
  object-fit: contain;
  opacity: 0;
}

@keyframes floatBounce {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes flyInFromTop {
  0% {
    transform: translateY(-100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes flyInFromBottom {
  0% {
    transform: translateY(100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.energy-icon-animated {
  animation: flyInFromBottom 1s ease-out forwards;
}

#highIcon.energy-icon-animated {
  animation-delay: 0.2s;
}

#lowIcon.energy-icon-animated {
  animation-delay: 0.5s;
}

#imageContainer img {
  width: 6.98cm;
  height: 5.39cm;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.popup-content {
  background: url("images/popup1.webp") no-repeat center center;
  background-size: cover;
  padding: 40px;
  border-radius: 30px;
  width: 500px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  animation: popupFadeIn 0.3s ease-out forwards;
}

@keyframes popupFadeIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.popup-content h1 {
  font-size: 28px;
  color: #F4EDE0;
  margin-bottom: 5px !important;
}

.popup-content h2 {
  font-size: 24px;
  color: #F4EDE0;
  margin-bottom: 25px !important;
}

.popup-content p {
  font-size: 20px;
  color: #F4EDE0;
  margin-bottom: 30px !important;
}

.popup-buttons {
  display: flex;
  justify-content: space-around;
}

#logButton, #backButton {
  font-size: 20px;
  color: #F4EDE0;
  border: none;
  padding: 12px 30px;
  border-radius: 12px;
  cursor: pointer;
}

#logButton {
  background-color: #8A9D80;
}

#backButton {
  background-color: #CD968C;
}

.home-button {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 20px;
  padding: 5px 30px;
  background-color: rgba(124, 122, 142, 0.65);
  color: #F4EDE0;
  font-size: 15px;
  border-radius: 12px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease;
}

@media (max-width: 768px) {
  #imageContainer {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    overflow-y: auto;
    padding: 140px 20px 40px 20px !important;
    gap: 20px;
    height: 100vh;
    box-sizing: border-box;
  }

  #imageContainer img {
    width: 90vw;
    height: auto;
  }

  .main-screen, .energy-screen {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 160px;
    gap: 20px;
  }

  .bubble {
    width: min(55vw, 5cm);
    height: min(55vw, 5cm);
    font-size: 20px;
  }

  .energy-bubble {
    width: min(70vw, 6cm);
    height: min(70vw, 6cm);
  }

  .high-icon, .low-icon {
    width: 60%;
    height: auto;
  }
}
