/* ============================================
   Wish Wall — 赛博许愿墙
   Ethereal sky lantern experience
   ============================================ */

/* --- Container & Background --- */
.wishwall-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-void);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Starfield pseudo-element */
.wishwall-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.7) 50%, transparent 50%),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 40% 10%, rgba(255,255,255,0.8) 50%, transparent 50%),
    radial-gradient(1px 1px at 55% 55%, rgba(255,255,255,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 85% 45%, rgba(255,255,255,0.7) 50%, transparent 50%),
    radial-gradient(1px 1px at 15% 70%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.3) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 50% 75%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1px 1px at 65% 90%, rgba(255,255,255,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 80% 65%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 5% 50%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 45% 30%, rgba(255,255,255,0.4) 50%, transparent 50%),
    radial-gradient(1px 1px at 60% 5%, rgba(255,255,255,0.7) 50%, transparent 50%),
    radial-gradient(1px 1px at 75% 50%, rgba(255,255,255,0.35) 50%, transparent 50%),
    radial-gradient(1px 1px at 20% 95%, rgba(255,255,255,0.5) 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 95% 15%, rgba(255,255,255,0.6) 50%, transparent 50%),
    radial-gradient(1px 1px at 35% 60%, rgba(255,255,255,0.3) 50%, transparent 50%),
    radial-gradient(1px 1px at 88% 35%, rgba(255,255,255,0.5) 50%, transparent 50%);
  animation: starsTwinkle 8s ease-in-out infinite alternate;
}

@keyframes starsTwinkle {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.7; }
}

/* --- Header --- */
.wishwall-header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--sp-12) var(--sp-6) var(--sp-4);
}

.wishwall-title {
  font-family: var(--font-display), cursive;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--neon-cyan) 60%, var(--gold) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
  margin-bottom: var(--sp-2);
  line-height: 1.3;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.wishwall-subtitle {
  font-family: var(--font-body), sans-serif;
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* --- Sky Area — lantern playground --- */
.wishwall-sky {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 50vh;
  min-height: 50dvh;
  overflow: hidden;
}

/* --- Lantern Base --- */
.lantern {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3) var(--sp-4);
  min-width: 64px;
  max-width: 140px;
  min-height: 48px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-md) var(--r-md);
  background: radial-gradient(ellipse at 50% 30%,
    rgba(255, 200, 80, 0.95) 0%,
    rgba(255, 160, 40, 0.85) 40%,
    rgba(210, 110, 30, 0.7) 100%);
  box-shadow:
    0 0 20px 6px rgba(255, 180, 50, 0.35),
    0 0 60px 12px rgba(255, 140, 30, 0.15),
    inset 0 -8px 16px rgba(200, 80, 10, 0.3);
  cursor: default;
  user-select: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform, opacity;
}

.lantern:hover {
  transform: scale(1.08) !important;
  box-shadow:
    0 0 30px 10px rgba(255, 200, 60, 0.5),
    0 0 80px 20px rgba(255, 160, 40, 0.2),
    inset 0 -8px 16px rgba(200, 80, 10, 0.3);
  z-index: 10;
}

/* Lantern tail */
.lantern::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid rgba(200, 100, 20, 0.65);
  filter: drop-shadow(0 4px 6px rgba(255, 140, 30, 0.3));
}

/* Lantern inner glow accent */
.lantern::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 8px;
  border-radius: var(--r-full);
  background: rgba(255, 240, 200, 0.5);
  filter: blur(4px);
}

/* Text inside lantern */
.lantern-text {
  font-family: var(--font-body), sans-serif;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(60, 30, 5, 0.9);
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  max-height: 2.7em;
  text-shadow: 0 0 4px rgba(255, 220, 150, 0.4);
}

/* --- Lantern States --- */

/* Rising: new wish just submitted */
.lantern.rising {
  animation: lanternRiseCustom 8s ease-out forwards;
}

@keyframes lanternRiseCustom {
  0% {
    opacity: 1;
    transform: translateY(0) scale(var(--lantern-scale, 1));
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-110vh) translateX(var(--drift-x, 20px)) scale(var(--lantern-scale, 1));
  }
}

/* Floating: existing wishes gently bobbing */
.lantern.floating {
  animation: lanternBob var(--bob-duration, 5s) ease-in-out infinite alternate;
}

@keyframes lanternBob {
  0%   { transform: translateY(0) scale(var(--lantern-scale, 1)); }
  100% { transform: translateY(calc(var(--bob-distance, -10px))) scale(var(--lantern-scale, 1)); }
}

/* Distance-based opacity for depth */
.lantern[data-depth="far"]    { opacity: 0.35; filter: blur(1px); }
.lantern[data-depth="mid"]    { opacity: 0.6; }
.lantern[data-depth="near"]   { opacity: 0.9; }

/* --- Input Area --- */
.wishwall-input-area {
  position: relative;
  z-index: 10;
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
  background: linear-gradient(to top,
    rgba(5, 5, 10, 0.95) 0%,
    rgba(5, 5, 10, 0.6) 70%,
    transparent 100%);
}

.wishwall-input-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.wishwall-input-row {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
}

.wish-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-primary);
  font-family: var(--font-body), sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wish-input::placeholder {
  color: var(--text-muted);
}

.wish-input:focus {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.1);
}

.wish-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: var(--bg-void);
  font-family: var(--font-display), cursive;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.wish-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

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

/* Anonymous toggle */
.wishwall-options {
  display: flex;
  align-items: center;
  margin-top: var(--sp-3);
  gap: var(--sp-2);
}

.anonymous-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-family: var(--font-body), sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  user-select: none;
  transition: color 0.2s ease;
}

.anonymous-toggle:hover {
  color: var(--text-primary);
}

.anonymous-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--glass-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.anonymous-toggle input[type="checkbox"]:checked {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--gold-dark);
}

.anonymous-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: var(--gold);
}

/* --- Lantern burst effect on submit --- */
.lantern-burst {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 60, 0.6) 0%, transparent 70%);
  pointer-events: none;
  animation: burstFade 0.8s ease-out forwards;
  z-index: 5;
}

@keyframes burstFade {
  0%   { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(3); opacity: 0; }
}

/* --- Empty state --- */
.wishwall-empty {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-body), sans-serif;
  font-size: 0.95rem;
  pointer-events: none;
}

.wishwall-empty .empty-icon {
  font-size: 2.5rem;
  margin-bottom: var(--sp-3);
  opacity: 0.5;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .wishwall-input-row {
    flex-direction: column;
  }

  .wish-send-btn {
    width: 100%;
  }

  .wishwall-header {
    padding-top: var(--sp-8);
  }

  .lantern {
    max-width: 110px;
    padding: var(--sp-2) var(--sp-3);
  }

  .lantern-text {
    font-size: 0.6rem;
  }
}
