:root {
  --primary: #ff4d6d;
  --secondary: #ff8fa3;
  --background: #fff0f3;
  --card-bg: #ffffff;
  --text: #592d33;
  --error: #e63946;
  --success: #38b000;
  --gold: #ffb703;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Cairo", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--background);
  color: var(--text);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  background: radial-gradient(circle, #fff0f3 0%, #ffc2d1 100%);
}

#app {
  width: 100%;
  max-width: 450px;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px;
  z-index: 10;
}

.stage {
  position: absolute;
  width: 95%;
  height: auto;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 10;
}

.stage.active {
  display: flex;
  opacity: 1;
}

.card {
  background: var(--card-bg);
  padding: 25px 20px;
  border-radius: 30px;
  box-shadow: 0 15px 40px rgba(255, 77, 109, 0.2);
  width: 100%;
  border: 3px solid var(--secondary);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* Scrollbar styling for final card */
.card::-webkit-scrollbar {
  width: 5px;
}
.card::-webkit-scrollbar-thumb {
  background: var(--secondary);
  border-radius: 10px;
}

.eid-decoration {
  font-size: 1.5rem;
  margin: 10px 0;
}

.top {
  margin-bottom: 20px;
}
.bottom {
  margin-top: 20px;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: var(--primary);
}
h2 {
  font-size: 1.4rem;
  margin-bottom: 15px;
  color: var(--primary);
}
h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  font-weight: 400;
}

.hint {
  background: #ffe5ec;
  padding: 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 15px;
  color: #c9184a;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

input {
  padding: 14px;
  border-radius: 15px;
  border: 2px solid var(--secondary);
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: all 0.3s;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(255, 77, 109, 0.1);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 20px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(255, 77, 109, 0.3);
}

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

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 20px;
  border-radius: 15px;
  font-size: 1rem;
}

.buttons-container {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
}

.error-msg {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 10px;
  height: 1.2rem;
}

/* Stage 4-8 Mini-game Styles */
.game-stage {
  width: 100vw;
  height: 100vh;
  max-width: none;
  justify-content: flex-start;
}

.game-instructions {
  margin-top: 40px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 20px;
  pointer-events: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.full-area {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
}

.catchable {
  width: 90px;
  height: 90px;
  position: absolute;
  cursor: pointer;
  object-fit: contain;
  border-radius: 50%;
  z-index: 10;
}

.overlay-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* Stage 5: Envelopes */
.envelopes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.envelope {
  cursor: pointer;
  transition: transform 0.3s;
}

.envelope:hover {
  transform: translateY(-5px);
}

.envelope img {
  width: 100%;
  height: auto;
}

/* Stage 6: Kahk */
.falling-kahk {
  width: 60px;
  height: 60px;
  position: absolute;
  cursor: pointer;
  z-index: 100;
  animation: fall 3s linear forwards;
}

@keyframes fall {
  from {
    transform: translateY(-100px);
  }
  to {
    transform: translateY(110vh);
  }
}

/* Stage 7: Lantern */
.lantern-container {
  padding: 30px;
  position: relative;
  cursor: pointer;
}

.lantern-img {
  width: 150px;
  height: auto;
  transition: transform 0.1s;
}

.lantern-img:active {
  transform: scale(1.1);
}

.glow-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, #ffb703 0%, rgba(255, 183, 3, 0) 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.progress-bar-container {
  width: 100%;
  height: 15px;
  background: #f0f0f0;
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(to right, var(--gold), var(--primary));
  transition: width 0.2s;
}

/* Stage 8: Balloon */
.floating-balloon {
  width: 70px;
  height: auto;
  position: absolute;
  cursor: pointer;
  z-index: 100;
  animation: floatUp 4s linear forwards;
}

@keyframes floatUp {
  from {
    transform: translateY(110vh);
  }
  to {
    transform: translateY(-100px);
  }
}

/* Stage 9: Choices */
.choice-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.choice-btn {
  padding: 15px;
  border-radius: 15px;
  border: 2px solid var(--secondary);
  background: white;
  cursor: pointer;
  font-weight: bold;
  color: var(--text);
  transition: all 0.3s;
}

.choice-btn:hover {
  background: var(--background);
}

/* Stage 10: Gift */
.gift-container {
  margin: 20px auto;
  width: 150px;
  height: 150px;
}

.gift-img {
  width: 100%;
  animation: shake 2s infinite ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
}

/* Final Stage Scrollable Layout Fix */
.final-card {
  padding: 20px;
  text-align: center;
}

.media-container {
  width: 100%;
  margin: 15px 0;
  border-radius: 20px;
  overflow: hidden;
  height: 200px;
}

.couple-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.final-msg {
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.mt-20 {
  margin-top: 20px;
}

/* Backgrounds */
.background-hearts,
.background-eid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.heart,
.eid-icon {
  position: absolute;
  animation: floatDecor 8s infinite linear;
  opacity: 0.15;
}

@keyframes floatDecor {
  0% {
    transform: translateY(100vh) rotate(0deg);
  }
  100% {
    transform: translateY(-10vh) rotate(360deg);
  }
}

.hidden-message {
  display: none;
  margin-top: 20px;
  padding: 15px;
  background: var(--primary);
  color: white;
  border-radius: 15px;
  font-weight: bold;
}
