:root {
  --bg-dark: #07120c;
  --bg-gradient: radial-gradient(circle at 50% 30%, #0e271a 0%, #06110a 70%, #020804 100%);
  --forest-green: #153e26;
  --bamboo-green: #2ecc71;
  --moon-light: rgba(167, 243, 208, 0.15);
  --text-gold: #fef08a;
  --text-white: #f8fafc;
  --text-muted: #86efac;
  --card-bg: rgba(15, 34, 23, 0.7);
  --card-border: rgba(74, 222, 128, 0.25);
  --font-global: 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  --font-serif: var(--font-global);
  --font-sans: var(--font-global);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  font-family: var(--font-global);
  background: var(--bg-dark);
  color: var(--text-white);
  touch-action: none;
}

/* ==========================================
   대나무숲 배경 및 실루엣
   ========================================== */
.forest-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* 달빛 아우라 */
.moon-glow {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(167, 243, 208, 0.12) 0%, rgba(52, 211, 153, 0.03) 50%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  animation: moonPulse 10s ease-in-out infinite alternate;
}

@keyframes moonPulse {
  0% { opacity: 0.6; transform: translateX(-50%) scale(0.95); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* ==========================================
   동화 원화 수묵 스타일 대나무 숲 (Fairytale Eastern Bamboo Forest)
   ========================================== */
.bamboo-silhouettes {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0.65;
  pointer-events: none;
  overflow: hidden;
}

/* 1. 원경 빽빽한 대나무 숲 (Far Layer) */
.bamboo-far-layer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0.45;
}

.far-stalk {
  position: absolute;
  top: -30px;
  bottom: -10px;
  width: 10px;
  background: linear-gradient(to top, rgba(50, 95, 45, 0.7), rgba(80, 140, 70, 0.35));
  border-radius: 2px;
}

.far-stalk::before {
  content: '';
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    to top,
    rgba(140, 195, 125, 0.3) 0px,
    rgba(140, 195, 125, 0.3) 2px,
    transparent 2px,
    transparent 80px
  );
}

.f1 { left: 1%; width: 11px; opacity: 0.65; transform: rotate(-0.8deg); }
.f2 { left: 6%; width: 8px; opacity: 0.55; transform: rotate(0.6deg); }
.f3 { left: 15%; width: 13px; opacity: 0.42; transform: rotate(-1.2deg); }
.f4 { left: 26%; width: 9px; opacity: 0.25; transform: rotate(0.5deg); }
.f5 { left: 37%; width: 14px; opacity: 0.18; transform: rotate(-0.7deg); }
.f6 { left: 52%; width: 10px; opacity: 0.18; transform: rotate(1.1deg); }
.f7 { left: 64%; width: 12px; opacity: 0.28; transform: rotate(-0.9deg); }
.f8 { left: 77%; width: 9px; opacity: 0.45; transform: rotate(0.6deg); }
.f9 { left: 88%; width: 11px; opacity: 0.55; transform: rotate(-1.0deg); }
.f10 { left: 97%; width: 8px; opacity: 0.65; transform: rotate(0.8deg); }

/* 2. 메인 대나무 레이어 (Main Bamboo Stalks) */
.bamboo-main-layer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.main-stalk {
  position: absolute;
  top: -45px;
  bottom: -10px;
  background: linear-gradient(to right, #254a20 0%, #4c8241 40%, #5d9850 65%, #21441c 100%);
  border-radius: 3px;
  box-shadow: inset 2px 0 4px rgba(185, 235, 165, 0.3), inset -2px 0 4px rgba(10, 25, 10, 0.5), 0 0 12px rgba(0, 0, 0, 0.45);
  transform-origin: bottom center;
  transition: opacity 0.3s ease;
}

/* ==========================================
   사실적인 불규칙 대나무 마디 링 (Realistic Irregular Joint Bulges & Rings)
   ========================================== */
.joint-ring {
  position: absolute;
  left: -3px;
  right: -3px;
  height: 6px;
  background: linear-gradient(to bottom, rgba(195, 245, 175, 0.85) 0%, rgba(65, 115, 55, 0.95) 45%, rgba(20, 45, 15, 0.9) 100%);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55), inset 0 1px 2px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 2;
}

/* 마디 중앙 돌출 입체감 디테일 */
.joint-ring::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 2px;
  right: 2px;
  height: 2px;
  background: rgba(220, 255, 200, 0.6);
  border-radius: 2px;
}

/* 대나무 줄기별 불규칙 마디 높이 간격 (자연스러운 좁음->넓어짐 변화) */
.s1 .j1 { bottom: 11%; }
.s1 .j2 { bottom: 26%; }
.s1 .j3 { bottom: 45%; }
.s1 .j4 { bottom: 68%; }
.s1 .j5 { bottom: 89%; }

.s2 .j1 { bottom: 15%; }
.s2 .j2 { bottom: 34%; }
.s2 .j3 { bottom: 58%; }
.s2 .j4 { bottom: 84%; }

.s3 .j1 { bottom: 9%; }
.s3 .j2 { bottom: 23%; }
.s3 .j3 { bottom: 41%; }
.s3 .j4 { bottom: 63%; }
.s3 .j5 { bottom: 86%; }

.s4 .j1 { bottom: 13%; }
.s4 .j2 { bottom: 29%; }
.s4 .j3 { bottom: 49%; }
.s4 .j4 { bottom: 71%; }
.s4 .j5 { bottom: 91%; }

.s5 .j1 { bottom: 18%; }
.s5 .j2 { bottom: 38%; }
.s5 .j3 { bottom: 61%; }
.s5 .j4 { bottom: 87%; }

.s6 .j1 { bottom: 10%; }
.s6 .j2 { bottom: 24%; }
.s6 .j3 { bottom: 43%; }
.s6 .j4 { bottom: 66%; }
.s6 .j5 { bottom: 88%; }

/* 대나무 줄기 완벽 고정 (Fixed Bamboo Stalks) */
.s1 { left: 2%; width: 36px; transform: rotate(-1.4deg); opacity: 0.95; }
.s2 { left: 11%; width: 22px; transform: rotate(1.0deg); opacity: 0.82; }
.s3 { left: 25%; width: 18px; transform: rotate(-0.6deg); opacity: 0.42; } /* 가운데 은은함 */
.s4 { right: 24%; width: 24px; transform: rotate(0.8deg); opacity: 0.45; } /* 가운데 은은함 */
.s5 { right: 10%; width: 20px; transform: rotate(-1.1deg); opacity: 0.82; }
.s6 { right: 1%; width: 32px; transform: rotate(1.5deg); opacity: 0.95; }

/* ==========================================
   동화 원화 방사형 별/우산 잎사귀 다발 (Radial Star-burst Leaf Sprays)
   ========================================== */
.star-leaf-spray {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
  animation: starSpraySway 5.2s ease-in-out infinite alternate;
}

/* 마디 배치 높이 (불규칙 마디 노드 링과 결합) */
.spray-top { bottom: 96%; left: 50%; }
.spray-high-left { bottom: 72%; left: -6px; }
.spray-high-right { bottom: 69%; right: -6px; }
.spray-mid-left { bottom: 44%; left: -6px; }
.spray-mid-right { bottom: 40%; right: -6px; }

/* 방사형 개별 잎사귀 (Star Leaf Blades) */
.star-leaf {
  position: absolute;
  top: -6px;
  left: -2px;
  width: 58px;
  height: 14px;
  background: linear-gradient(135deg, #58964c 0%, #31612b 65%, #183814 100%);
  border-radius: 0 95% 0 95%;
  transform-origin: left center;
  box-shadow: 0 0 8px rgba(88, 150, 76, 0.3);
}

/* 방사형 5가닥 부채꼴 펼침 각도 (360도/180도 방사) */
.sl1 { transform: rotate(-80deg) scale(1.1); }
.sl2 { transform: rotate(-42deg) scale(0.95); }
.sl3 { transform: rotate(-5deg) scale(1.05); }
.sl4 { transform: rotate(32deg) scale(1.18); }
.sl5 { transform: rotate(70deg) scale(1.0); }

/* 좌측 뻗은 가지 반대 방향 방사 각도 */
.spray-high-left .sl1,
.spray-mid-left .sl1 { transform: rotate(-135deg) scale(1.1); }

.spray-high-left .sl2,
.spray-mid-left .sl2 { transform: rotate(-165deg) scale(0.95); }

.spray-high-left .sl3,
.spray-mid-left .sl3 { transform: rotate(-105deg) scale(1.05); }

.spray-high-left .sl4,
.spray-mid-left .sl4 { transform: rotate(-65deg) scale(1.18); }

.spray-high-left .sl5,
.spray-mid-left .sl5 { transform: rotate(-25deg) scale(1.0); }

/* 줄기별 바람 애니메이션 시차 속도 차별화 */
.s1 .star-leaf-spray { animation-duration: 4.6s; animation-delay: -0.6s; }
.s2 .star-leaf-spray { animation-duration: 6.0s; animation-delay: -2.1s; }
.s3 .star-leaf-spray { animation-duration: 5.2s; animation-delay: -3.9s; }
.s4 .star-leaf-spray { animation-duration: 6.5s; animation-delay: -1.5s; }
.s5 .star-leaf-spray { animation-duration: 5.7s; animation-delay: -3.2s; }
.s6 .star-leaf-spray { animation-duration: 5.9s; animation-delay: -1.0s; }

/* 동화속 살랑이는 대나무 잎 바람 애니메이션 (Fairytale Wind Sway) */
@keyframes starSpraySway {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-6deg) scaleY(1.05) skewX(-3deg); }
  50% { transform: rotate(4deg) scaleY(0.95) skewX(2deg); }
  75% { transform: rotate(-7deg) scaleY(1.04) skewX(-4deg); }
  100% { transform: rotate(3deg) scaleY(0.98) skewX(1deg); }
}

@keyframes leafRustleRight {
  0% { transform: rotate(0deg) scaleY(1); }
  25% { transform: rotate(7deg) scaleY(1.06) skewX(3deg); }
  50% { transform: rotate(-4deg) scaleY(0.95) skewX(-2deg); }
  75% { transform: rotate(9deg) scaleY(1.07) skewX(5deg); }
  100% { transform: rotate(-2deg) scaleY(0.97) skewX(-1deg); }
}

/* ==========================================
   헤더 레이아웃 (완전 고정)
   ========================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 30;
  text-align: center;
  padding: 20px 16px 8px 16px;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-logo-img {
  width: 100%;
  max-width: 380px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.6));
  user-select: none;
  pointer-events: none;
  transition: transform 0.3s ease;
}

/* ==========================================
   우측 상단 실시간 참여자 수 배지 (완전 고정)
   ========================================== */
.listener-badge {
  position: fixed;
  top: 14px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 30, 20, 0.7);
  border: 1px solid rgba(74, 222, 128, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 4px 10px;
  color: #a7f3d0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  user-select: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.listener-badge:hover {
  background: rgba(15, 42, 28, 0.8);
  border-color: rgba(74, 222, 128, 0.5);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.3);
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #2ecc71;
  border-radius: 50%;
  box-shadow: 0 0 8px #2ecc71;
  animation: liveDotPulse 2s ease-in-out infinite;
}

@keyframes liveDotPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(46, 204, 113, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
  }
}

.listener-count-text {
  font-family: var(--font-global);
  white-space: nowrap;
}

/* ==========================================
   메시지 허공 캔버스 (Whisper Container - 로고 아래 ~ 입력창 위 범위)
   ========================================== */
.whisper-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: hidden !important;
}

/* ==========================================
   대나무숲 허공 순수 글자 (Pure Text Floating Style)
   ========================================== */
.whisper-item {
  position: absolute;
  display: inline-block;
  word-break: break-word;
  white-space: pre-wrap;
  max-width: 380px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-white);
  font-family: var(--font-global);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  pointer-events: none;
  user-select: none;
  z-index: 10;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4), 0 2px 10px rgba(0, 0, 0, 0.9);

  /* 순수 글자 샤우팅 모션 */
  animation: shoutEcho var(--duration, 4s) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 다채로운 무작위 글자 네온 컬러 팔레트 8종 */
.whisper-item.color-gold {
  color: #fef08a;
  text-shadow: 0 0 16px rgba(254, 240, 138, 0.7), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-cyan {
  color: #7dd3fc;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.7), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-emerald {
  color: #6ee7b7;
  text-shadow: 0 0 16px rgba(52, 211, 153, 0.7), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-purple {
  color: #e9d5ff;
  text-shadow: 0 0 16px rgba(192, 132, 252, 0.75), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-pink {
  color: #fbcfe8;
  text-shadow: 0 0 16px rgba(244, 114, 182, 0.75), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-orange {
  color: #ffedd5;
  text-shadow: 0 0 16px rgba(251, 146, 60, 0.75), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-lime {
  color: #ecfccb;
  text-shadow: 0 0 16px rgba(163, 230, 53, 0.7), 0 2px 12px rgba(0, 0, 0, 0.9);
}

.whisper-item.color-white {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.8), 0 2px 12px rgba(0, 0, 0, 0.9);
}

/* 샤우팅 애니메이션: 부드럽게 나타나 이동하며 후반부에 서서히 페이드아웃 */
@keyframes shoutEcho {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.85) rotate(var(--rot-start, -4deg));
    filter: blur(4px);
  }
  15% {
    opacity: var(--max-op, 1);
    transform: translate(calc(var(--dx) * 0.15), calc(var(--dy) * 0.15)) scale(1.04) rotate(var(--rot-start, -4deg));
    filter: blur(0px);
  }
  60% {
    opacity: var(--max-op, 1);
    transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.6)) scale(1.02) rotate(calc(var(--rot-start, -4deg) + 2deg));
    filter: blur(0px);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.08) rotate(var(--rot-end, 4deg));
    filter: blur(8px);
  }
}

/* 사운드 파동 링 퍼짐 애니메이션 */
@keyframes waveRing {
  0% {
    opacity: 0.9;
    transform: scale(0.9);
  }
  30% {
    opacity: 0;
    transform: scale(1.45);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

/* ==========================================
   하단 고정 입력창
   ========================================== */
.input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  padding: 16px 20px 24px 20px;
  background: linear-gradient(to top, rgba(3, 10, 6, 0.95) 0%, rgba(3, 10, 6, 0.7) 70%, transparent 100%);
  display: flex;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0.2, 1);
  will-change: transform;
}

.input-form {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
}

.input-wrapper {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  padding: 4px 18px;
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(74, 222, 128, 0.6);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7), 0 0 15px rgba(74, 222, 128, 0.2);
}

.whisper-input {
  width: 100%;
  height: 42px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-white);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  line-height: 42px;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  white-space: nowrap;
  caret-color: #4ade80;
  caret-shape: block;
}

.whisper-input::placeholder {
  color: rgba(167, 243, 208, 0.45);
  font-weight: 400;
  font-style: italic;
  padding-left: 24px;
}

.send-btn {
  background: linear-gradient(135deg, #15803d, #047857);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.4);
}

.send-btn:hover {
  background: linear-gradient(135deg, #16a34a, #059669);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.5);
}

.send-btn:active {
  transform: translateY(1px);
}

.send-btn.disabled,
.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================
   반응형 모바일 스타일
   ========================================== */
@media (max-width: 600px) {
  .header {
    padding: 12px 12px 4px 12px;
  }
  .main-logo-img {
    max-width: 260px;
  }
  .listener-badge {
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    font-size: 0.72rem;
    gap: 6px;
  }
  .live-dot {
    width: 6px;
    height: 6px;
  }
  .whisper-item {
    max-width: 240px;
    padding: 8px 12px;
    font-size: 0.9rem !important;
  }
  .input-bar {
    padding: 10px 12px 16px 12px;
  }
  .input-form {
    padding: 6px 10px;
    border-radius: 24px;
  }
  .send-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}
