:root {
  --header-height: 40px;
  --footer-height: 60px;
  --form-gap: 12px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0a0a1a;
  color: white;
  font-family: versatile, geometric sans-serif;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--header-height); /* leave space for header */
}

/* ---------- Header & Logo ---------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;

  /* Transparent with blur */
  background: rgba(5, 5, 12, 0.45);
  backdrop-filter: blur(6px);

  /* subtle shadow only */
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

header h1 {
  margin: 0;
  font-size: clamp(20px, 3.6vw, 30px);
  letter-spacing: 0.5px;
  text-shadow: 
    0 0 6px rgba(255, 200, 150, 0.8),
    0 0 12px rgba(255, 120, 60, 0.6);
  animation: textGlow 4s ease-in-out infinite alternate;
}

/* Logo placed left but vertically centered in header */
#logo {
  position: absolute;
  left: 18px;
  top: 100%;
  transform: translateY(-50%);
  width: 190px;
  height: auto;
  z-index: 50;
  user-select: none;

  /* glowing animation for logo */
  filter: drop-shadow(0 0 8px rgba(255, 200, 120, 0.9));
  animation: logoGlow 4s ease-in-out infinite alternate;
}

/* Glow Animations */
@keyframes textGlow {
  0% {
    text-shadow: 
      0 0 4px rgba(255, 180, 100, 0.6),
      0 0 8px rgba(255, 120, 60, 0.4);
  }
  100% {
    text-shadow: 
      0 0 10px rgba(255, 220, 160, 0.9),
      0 0 20px rgba(255, 140, 80, 0.7);
  }
}

@keyframes logoGlow {
  0% {
    filter: drop-shadow(0 0 4px rgba(255, 180, 100, 0.6));
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(255, 220, 160, 1));
  }
}

/* ---------- Intro text under header ---------- */
header + p {
  margin: 8px 0 18px 0;
  font-size: clamp(12px, 1.4vw, 16px);
  color: #e8e8f0;
  position: relative;
  z-index: 20;
}

/* ---------- Balloon Cloud ---------- */
#balloon-cloud {
  position: relative;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  min-height: 360px;
  overflow: hidden;
  background: linear-gradient(to top, #02010a, #101020);
}

/* Balloon Container */
.balloon {
  position: absolute;
  bottom: -80px;
  animation: floatUp 15s linear infinite;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* balloon sizes respond to viewport */
.balloon-shape {
  width: clamp(28px, 3.2vw, 52px);
  height: clamp(40px, 4.4vw, 72px);
  border-radius: 16px;
  background: linear-gradient(to top, #ff9a9e, #fad0c4);
  box-shadow: 0 0 20px rgba(255, 200, 200, 0.7);
}

/* Glow */
.balloon-shape.glow {
  filter: drop-shadow(0 0 12px currentColor);
}

/* String Coil */
.coil {
  width: 6px;
  height: 20px;
  background: repeating-linear-gradient(
    to bottom,
    #ffb347,
    #ffb347 2px,
    #ff7e00 2px,
    #ff7e00 4px
  );
  border-radius: 50%;
  margin-top: -3px;
}

/* Floating Animation */
@keyframes floatUp {
  0% { transform: translateY(0); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-100vh); opacity: 0; }
}

/* ---------- Wish Form (centered & responsive) ---------- */
#wish-form {
  position: fixed;
  bottom: var(--footer-height);   /* sit above footer */
  left: 50%;
  transform: translateX(-50%);
  
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--form-gap);

  z-index: 60;
  padding: 12px;
  border-radius: 12px;
  background: rgba(5,5,8,0.5);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);

  width: min(90%, 480px);
  max-width: 480px;
}

/* textarea */
#wishText {
  width: 100%;
  height: 50px;
  border-radius: 8px;
  padding: 10px 12px;
  border: none;
  resize: vertical;
  font-size: 14px;
  line-height: 1.2;
  outline: none;
}

/* button */
#submitWish {
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffb347, #ff7e00);
  border: none;
  cursor: pointer;
  font-weight: 700;
  color: #0b0b0b;
  box-shadow: 0 6px 12px rgba(0,0,0,0.45);
  white-space: nowrap;
}

/* focus & active states */
#wishText:focus { box-shadow: 0 0 0 3px rgba(255,190,90,0.12); }
#submitWish:active { transform: translateY(1px); }

/* ---------- Footer ---------- */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  font-size: 13px;
  color: #cfcfdb;
  z-index: 60;
  background: rgba(5,5,8,0.25);
  padding: 8px 12px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ---------- Popup ---------- */
#wish-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: none; /* shown via script by setting display:flex */
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.popup-box {
  background: linear-gradient(145deg, #3b0a91, #25055d);
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  color: white;
  width: min(420px, 90vw);
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
  animation: popupScale 0.3s ease;
}

@keyframes popupScale {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.popup-balloon {
  width: 60px;
  height: 90px;
  border-radius: 20px;
  margin: 0 auto 15px;
  box-shadow: 0 0 25px rgba(255,255,255,0.7);
}

.popup-coil {
  width: 10px;
  height: 25px;
  background: repeating-linear-gradient(
    to bottom,
    #ffb347,
    #ffb347 3px,
    #ff7e00 3px,
    #ff7e00 6px
  );
  margin: 0 auto 15px;
  border-radius: 50%;
}

.popup-box h2 { margin: 10px 0; }
.popup-box p { margin: 8px 0; font-size: 14px; }
.popup-box button {
  margin-top: 15px;
  padding: 8px 15px;
  border: none;
  border-radius: 6px;
  background: #6c63ff;
  color: white;
  cursor: pointer;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 520px) {
  :root { --header-height: 92px; --footer-height: 80px; --form-gap: 10px; }
  #logo { width: 86px; left: 12px; }
  header { height: var(--header-height); padding: 6px 12px; }
  body { padding-top: var(--header-height); }

  #submitWish {
    width: 100%;
    margin-top: 6px;
  }

  footer {
    font-size: 12px;
    padding: 6px 10px;
  }
}

@media (min-width: 521px) and (max-width: 900px) {
  #logo { width: 100px; }
  header { height: var(--header-height); }
  #balloon-cloud { min-height: 300px; }
}

@media (max-height: 500px) {
  #balloon-cloud {
    height: calc(100vh - var(--header-height) - 48px);
    min-height: 240px;
  }
}

/* ---------- Wish Counter ---------- */
#wish-counter {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: bold;
  color: #ffda6b;
  text-shadow: 0 0 6px rgba(255, 180, 80, 0.9);
  z-index: 60;
}

/* Character counter above textarea */
#char-counter {
  font-size: 13px;
  color: #ffda6b;
  margin-bottom: 4px;
  text-align: left;
  display: block;
  width: 100%;
}

/* Add spacing between textarea and captcha */
.g-recaptcha {
  margin: 8px 0;
}
