@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #040612;
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Background Canvas */
#skyCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
  cursor: crosshair;
}

/* Header & Topbar */
#topbar {
  position: fixed;
  top: 18px;
  left: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  gap: 16px;
}

.brand-title {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Glassmorphic Back Pill */
.back-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 24px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.back-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 215, 138, 0.5);
  transform: translateX(-2px);
}

.back-arrow {
  transition: transform 0.2s ease;
}

.back-pill:hover .back-arrow {
  transform: translateX(-3px);
}

/* Celestial Emblem Container */
.celestial-emblem {
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 215, 138, 0.22);
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(255, 215, 138, 0.06);
  transition: all 0.3s ease;
}

.celestial-emblem:hover {
  border-color: rgba(255, 215, 138, 0.45);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 215, 138, 0.12);
}

.emblem-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.emblem-glow-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 8px #ffd166);
}

.emblem-text-gradient {
  background: linear-gradient(135deg, #ffffff 15%, #ffeaa7 55%, #ffd166 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(255, 209, 102, 0.4);
}

.emblem-subtitle {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 3px;
  font-weight: 300;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sparkle-dot {
  color: #ffd166;
  font-size: 0.7rem;
  animation: pulseSparkle 2.5s infinite alternate ease-in-out;
}

/* Topbar Actions Group */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* The Eternal Star Spotlight Button */
.eternal-star-btn {
  background: linear-gradient(135deg, rgba(255, 67, 112, 0.28), rgba(255, 209, 102, 0.32));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 209, 102, 0.65);
  color: #fff2d1;
  padding: 8px 16px;
  border-radius: 30px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 0 20px rgba(255, 67, 112, 0.35), inset 0 0 10px rgba(255, 209, 102, 0.2);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  animation: pulseEternalBtn 3s infinite alternate ease-in-out;
}

.eternal-star-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: linear-gradient(135deg, rgba(255, 67, 112, 0.45), rgba(255, 209, 102, 0.5));
  border-color: #ffeaa7;
  box-shadow: 0 0 35px rgba(255, 67, 112, 0.55), 0 0 20px rgba(255, 209, 102, 0.45);
}

.eternal-star-btn:active {
  transform: scale(0.98);
}

@keyframes pulseEternalBtn {
  0% { box-shadow: 0 0 15px rgba(255, 67, 112, 0.25); }
  100% { box-shadow: 0 0 30px rgba(255, 67, 112, 0.5), 0 0 16px rgba(255, 209, 102, 0.4); }
}

/* Sound Toggle Button */
.sound-btn {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  padding: 8px 14px;
  border-radius: 30px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.sound-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

#totalWishesBadge {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 215, 138, 0.28);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #ffe6b3;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 215, 138, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.3s ease;
}

#totalWishesBadge:hover {
  border-color: rgba(255, 215, 138, 0.55);
  box-shadow: 0 4px 25px rgba(255, 215, 138, 0.3);
}
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

#totalWishesBadge:hover {
  border-color: rgba(255, 215, 138, 0.5);
  box-shadow: 0 4px 25px rgba(255, 215, 138, 0.25);
}

/* Bottom Wish Release Capsule */
#bottomBar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.release-btn {
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.2), rgba(255, 112, 67, 0.25));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 215, 138, 0.4);
  color: #fff;
  padding: 14px 28px;
  border-radius: 40px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 183, 77, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  letter-spacing: 0.3px;
}

.release-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.35), rgba(255, 112, 67, 0.4));
  border-color: rgba(255, 215, 138, 0.7);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 35px rgba(255, 183, 77, 0.5);
}

.release-btn:active {
  transform: scale(0.98);
}

.sparkle-icon {
  font-size: 1.2rem;
  animation: pulseSparkle 2s infinite alternate ease-in-out;
}

@keyframes pulseSparkle {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px #ffe082); }
  100% { transform: scale(1.2) rotate(15deg); filter: drop-shadow(0 0 8px #ffe082); }
}

/* Modals Common Backdrop */
.modal-wrapper {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-wrapper.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 12, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 101;
  width: min(560px, calc(100vw - 32px));
  background: radial-gradient(circle at top left, rgba(28, 36, 62, 0.96), rgba(10, 14, 28, 0.98));
  border: 1px solid rgba(255, 215, 138, 0.3);
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(255, 183, 77, 0.18);
  padding: 32px;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-wrapper.active .modal-card {
  transform: translateY(0) scale(1);
}

/* Eternal Star Special Modal Card Aura */
.modal-card--eternal {
  border: 1px solid rgba(255, 209, 102, 0.7);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.9), 0 0 60px rgba(255, 67, 112, 0.35), 0 0 30px rgba(255, 209, 102, 0.25);
  background: radial-gradient(circle at top, rgba(48, 20, 48, 0.97), rgba(10, 14, 28, 0.98));
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: rotate(90deg);
}

/* Wish Composer Modal */
.composer-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: #ffe6b3;
  margin-bottom: 6px;
  text-shadow: 0 0 15px rgba(255, 215, 138, 0.3);
}

.composer-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
  line-height: 1.4;
}

.textarea-container {
  position: relative;
  margin-bottom: 20px;
}

.wish-textarea {
  width: 100%;
  height: 150px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 138, 0.25);
  border-radius: 16px;
  padding: 16px;
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  user-select: text;
  -webkit-user-select: text;
}

.wish-textarea:focus {
  border-color: rgba(255, 215, 138, 0.7);
  box-shadow: 0 0 20px rgba(255, 215, 138, 0.25);
}

.wish-textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
}

.char-counter {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.submit-wish-btn {
  width: 100%;
  background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
  border: none;
  color: #0b0e14;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(251, 140, 0, 0.4);
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.submit-wish-btn:hover {
  background: linear-gradient(135deg, #ffb74d 0%, #ffa726 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(251, 140, 0, 0.6);
}

.submit-wish-btn:active {
  transform: translateY(0);
}

/* Wish Reader Modal */
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.reader-badge {
  background: rgba(255, 183, 77, 0.16);
  border: 1px solid rgba(255, 183, 77, 0.35);
  color: #ffe082;
  font-size: 0.75rem;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.reader-badge--forever {
  background: linear-gradient(135deg, rgba(255, 67, 112, 0.32), rgba(255, 209, 102, 0.3));
  border: 1px solid rgba(255, 209, 102, 0.75);
  color: #fff2d1;
  box-shadow: 0 0 16px rgba(255, 67, 112, 0.35);
  font-size: 0.8rem;
  letter-spacing: 0.8px;
}

.reader-eternal-note {
  font-size: 0.85rem;
  color: #ffb3c6;
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.4;
  text-shadow: 0 0 10px rgba(255, 67, 112, 0.3);
}

.reader-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  line-height: 1.75;
  color: #fffbf0;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 24px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 8px;
  user-select: text;
  -webkit-user-select: text;
}

.reader-text::-webkit-scrollbar {
  width: 5px;
}

.reader-text::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 138, 0.35);
  border-radius: 5px;
}

.reader-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.reader-time {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
}

.bless-btn {
  background: linear-gradient(135deg, rgba(255, 215, 138, 0.12), rgba(255, 67, 112, 0.15));
  border: 1px solid rgba(255, 215, 138, 0.35);
  color: #ffe8b3;
  padding: 8px 18px;
  border-radius: 20px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.bless-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 138, 0.25), rgba(255, 67, 112, 0.25));
  border-color: rgba(255, 215, 138, 0.7);
  box-shadow: 0 0 15px rgba(255, 215, 138, 0.3);
  transform: scale(1.05);
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: #ffe082;
  margin-left: 2px;
  vertical-align: middle;
  animation: cursorBlink 0.8s infinite step-start;
}

@keyframes cursorBlink {
  50% { opacity: 0; }
}

/* Tooltip on Canvas Hover */
#lanternTooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: rgba(10, 14, 28, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 215, 138, 0.45);
  color: #ffe082;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lanternTooltip.visible {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-16px);
}

#lanternTooltip.tooltip--eternal {
  border-color: rgba(255, 209, 102, 0.75);
  box-shadow: 0 0 25px rgba(255, 67, 112, 0.4), 0 4px 20px rgba(0, 0, 0, 0.6);
  background: rgba(26, 12, 28, 0.92);
  color: #fff2d1;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  #topbar {
    top: 12px;
    left: 12px;
    right: 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .brand-title {
    gap: 6px;
  }

  .back-pill {
    padding: 6px 10px;
    font-size: 0.76rem;
    border-radius: 18px;
  }

  .back-text {
    display: none;
  }

  .celestial-emblem {
    padding: 5px 12px;
    border-radius: 16px;
  }

  .emblem-title {
    font-size: 1.15rem;
    gap: 5px;
  }

  .emblem-glow-icon {
    font-size: 1.05rem;
  }

  .emblem-subtitle {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .eternal-star-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    border-radius: 20px;
    gap: 4px;
  }

  .star-btn-label {
    display: none;
  }

  .sound-btn {
    padding: 6px 10px;
    font-size: 0.74rem;
    border-radius: 20px;
  }

  .sound-label {
    display: none;
  }

  #totalWishesBadge {
    padding: 6px 10px;
    font-size: 0.74rem;
    border-radius: 20px;
  }

  #bottomBar {
    bottom: 18px;
    width: calc(100vw - 28px);
  }

  .release-btn {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
    font-size: 0.92rem;
    border-radius: 35px;
  }

  .modal-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .reader-text {
    font-size: 1.22rem;
    line-height: 1.65;
    max-height: 58vh;
  }
}

@media (min-width: 480px) and (max-width: 768px) {
  .star-btn-label {
    display: inline;
  }
  .sound-label {
    display: inline;
  }
  .back-text {
    display: inline;
  }
}
