/* Dragon Breath Game - Main Stylesheet */

:root {
  --primary-green: #48BB78;
  --sky-top: #A0E7E5;
  --sky-bottom: #B4F8C8;
  --water-blue: #4EA8DE;
  --stone-color: #6C7A89;
  --stone-active: #FDE24F;
  --cake-pink: #FF9AA2;
  --gold-accent: #FFD166;
  --text-dark: #2D3748;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: #64B5F6;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ================= Game Canvas & Stage ================= */
#gameStage {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #81D4FA 0%, #B2EBF2 45%, #E0F7FA 65%, #80DEEA 100%);
  overflow: hidden;
}

/* Background Landscape Elements */
.bg-sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  pointer-events: none;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}
.cloud-1 { top: 12%; left: 8%; width: 140px; height: 45px; animation: floatCloud 28s linear infinite; }
.cloud-2 { top: 22%; left: 65%; width: 180px; height: 55px; animation: floatCloud 36s linear infinite; }
.cloud-3 { top: 8%; left: 45%; width: 110px; height: 35px; animation: floatCloud 24s linear infinite; }

.sun {
  position: absolute;
  top: 6%;
  right: 12%;
  width: 80px;
  height: 80px;
  background: #FFF176;
  border-radius: 50%;
  box-shadow: 0 0 40px #FFEE58;
}

/* Rolling Hills */
.hills {
  position: absolute;
  bottom: 25%;
  left: 0;
  width: 100%;
  height: 35%;
  background: radial-gradient(ellipse at 50% 100%, #81C784 0%, #66BB6A 60%, #4CAF50 100%);
  border-top-left-radius: 40% 100px;
  border-top-right-radius: 40% 100px;
  z-index: 1;
}

/* Water Stream / Pond */
.water-pond {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35%;
  background: linear-gradient(180deg, #4FC3F7 0%, #0288D1 100%);
  z-index: 2;
  border-top: 4px solid #B3E5FC;
}

.water-ripple {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0.25;
  background: repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(255,255,255,0.4) 15px, rgba(255,255,255,0.4) 30px);
  animation: rippleMove 8s linear infinite;
}

/* Left Start Bank */
.start-bank {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 20%;
  height: 35%;
  background: linear-gradient(180deg, #81C784 0%, #43A047 100%);
  border-top-right-radius: 60px;
  z-index: 3;
  box-shadow: 2px 0 10px rgba(0,0,0,0.15);
}

.start-flowers {
  position: absolute;
  top: -12px;
  left: 30%;
  font-size: 24px;
}

/* Right Cake Pedestal */
.cake-pedestal {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20%;
  height: 35%;
  background: linear-gradient(180deg, #AED581 0%, #7CB342 100%);
  border-top-left-radius: 60px;
  z-index: 3;
  box-shadow: -2px 0 10px rgba(0,0,0,0.15);
}

/* ================= Stepping Stones ================= */
.stones-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35%;
  pointer-events: none;
  z-index: 3;
}

.stone {
  position: absolute;
  bottom: 45%;
  width: 80px;
  height: 48px;
  background: radial-gradient(ellipse at 40% 30%, #CFD8DC 0%, #90A4AE 60%, #546E7A 100%);
  border-radius: 50%;
  transform: translate(-50%, 0);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.stone-number {
  font-size: 18px;
  font-weight: 800;
  color: #ECEFF1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.stone.active {
  background: radial-gradient(ellipse at 40% 30%, #FFF59D 0%, #FBC02D 60%, #F57F17 100%);
  box-shadow: 0 0 25px #FDD835, 0 8px 12px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, 3px) scale(1.05);
}

.stone.active .stone-number {
  color: #5D4037;
  text-shadow: none;
}

/* ================= Dragon Character ================= */
.dragon {
  position: absolute;
  width: 130px;
  height: 130px;
  z-index: 10;
  pointer-events: none;
  transition: transform 0.1s ease;
}

.dragon-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.2));
}

.dragon-breath {
  position: absolute;
  top: 35px;
  right: -60px;
  width: 90px;
  height: 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dragon-breath.active {
  opacity: 1;
}

/* ================= Birthday Cake ================= */
.cake-wrapper {
  position: absolute;
  bottom: 27%;
  right: 6%;
  width: 120px;
  height: 130px;
  z-index: 5;
  transition: transform 0.3s ease;
}

.cake-wrapper.ready-target {
  animation: cakeTada 1.2s infinite;
}

.cake-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.18));
}

.candle-flame {
  opacity: 0;
  transform-origin: center bottom;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.candle-flame.lit {
  opacity: 1;
  animation: flameFlicker 0.6s infinite alternate;
}

/* ================= Top Prompt & Live Star ================= */
.top-hud {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  width: 90%;
  max-width: 680px;
  pointer-events: none;
}

.speech-bubble {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 14px 28px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.12), 0 0 0 4px #81D4FA;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.mic-star {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: #FFE082;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  transition: transform 0.1s ease, background-color 0.2s ease;
  box-shadow: 0 0 10px #FFD54F;
}

.mic-star.glowing {
  background: #FF5722;
  box-shadow: 0 0 25px #FF5722;
}

.prompt-text {
  font-size: 22px;
  font-weight: 700;
  color: #2D3748;
  line-height: 1.3;
}

.mic-status-text {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #455A64;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 14px;
  border-radius: 12px;
}
.mic-status-text.active { color: #2E7D32; }
.mic-status-text.error { color: #C62828; }

/* ================= Bottom Controls for Therapist ================= */
.bottom-bar {
  position: absolute;
  bottom: 12px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  pointer-events: auto;
}

.hud-btn {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #B0BEC5;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #37474F;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.hud-btn:hover {
  background: #FFFFFF;
  border-color: #0288D1;
  transform: translateY(-2px);
}

.license-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 14px;
}
.license-badge.active {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
}
.license-badge.trial {
  background: #FFF8E1;
  color: #F57F17;
  border: 1px solid #FFE082;
}

/* ================= Overlay Canvas for Particles ================= */
#fxCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 30;
  pointer-events: none;
}

/* ================= Victory Screen ================= */
.victory-banner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.victory-banner.show {
  opacity: 1;
  pointer-events: auto;
}

.victory-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF9C4 100%);
  border: 6px solid #FFD54F;
  border-radius: 36px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  max-width: 500px;
  animation: bannerPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.victory-title {
  font-size: 40px;
  font-weight: 900;
  color: #E65100;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.victory-desc {
  font-size: 20px;
  color: #455A64;
  margin-bottom: 24px;
}

.btn-restart {
  background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
  color: #FFFFFF;
  font-size: 22px;
  font-weight: 800;
  padding: 14px 36px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(46, 125, 50, 0.4);
  transition: transform 0.2s;
}

.btn-restart:hover {
  transform: scale(1.05);
}

/* ================= Modals (Settings & License) ================= */
.modal-overlay {
  position: absolute;
  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: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  background: #FFFFFF;
  width: 90%;
  max-width: 520px;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.25);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  border-bottom: 1px solid #ECEFF1;
  padding-bottom: 12px;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: #263238;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #78909C;
  cursor: pointer;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #37474F;
  margin-bottom: 6px;
}

.form-help {
  font-size: 12px;
  color: #78909C;
  margin-top: 4px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-container input[type="range"] {
  flex: 1;
  accent-color: #0288D1;
}

.meter-wrapper {
  position: relative;
  width: 100%;
  height: 16px;
  background: #E0E0E0;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 6px;
}

.mic-bar {
  height: 100%;
  width: 0%;
  background: #4CAF50;
  transition: width 0.05s ease;
}

.mic-bar.active {
  background: #FF5722;
}

.threshold-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #D32F2F;
}

.select-input, .text-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #CFD8DC;
  font-size: 14px;
}

.action-btn {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #0288D1;
  color: white;
  transition: background 0.2s;
  margin-top: 6px;
}

.action-btn:hover { background: #0277BD; }
.action-btn.secondary { background: #ECEFF1; color: #37474F; }
.action-btn.secondary:hover { background: #CFD8DC; }

.status-msg {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}
.status-msg.success { color: #2E7D32; }
.status-msg.warning { color: #F57F17; }
.status-msg.error { color: #C62828; }
