body {
  margin: 0;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  background-image:
    linear-gradient(rgba(248, 244, 236, 0.18), rgba(248, 244, 236, 0.18)),
    url("bg.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

.app {
  position: relative;
  z-index: 2;
  background: rgba(255, 250, 245, 0.95);
  width: 90%;
  max-width: 540px;
  padding: 32px;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(60, 20, 20, 0.25);
  border: 1px solid rgba(180, 70, 70, 0.2);
}

h1 {
  color: #8b1e1e;
  margin-bottom: 8px;
}

.chinese-title {
  margin-top: -6px;
  margin-bottom: 6px;
  font-size: 18px;
  color: #a61e4d;
  opacity: 0.8;
}

.subtitle {
  text-align: center;
  font-size: 14px;
  color: #6b4a4a;
  margin-top: 0;
  margin-bottom: 10px;
  opacity: 0.8;
}

.input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: center;
}

input {
  flex: 1;
  padding: 14px 16px;
  font-size: 18px;
  border: 1px solid #d8c7c7;
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.88);
  color: #3a2020;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: #b33a3a;
  box-shadow: 0 0 0 4px rgba(179, 58, 58, 0.14);
}

button {
  padding: 14px 20px;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  background: #b33434;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

button:hover {
  background: #922626;
}

button:active {
  transform: scale(0.98);
}

#result {
  margin-top: 16px;
  padding: 20px;
  background: rgba(255, 248, 245, 0.86);
  border: 1px solid rgba(179, 58, 58, 0.12);
  border-radius: 16px;
}

#result p {
  margin: 10px 0;
  font-size: 18px;
  color: #3d2a2a;
  line-height: 1.5;
}

#chinese {
  font-size: 28px;
  font-weight: bold;
}

#tone {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(179, 58, 58, 0.15);
  font-weight: bold;
  color: #8e1f1f;
}

/* Dragon */
.dragon-float {
  position: fixed;
  top: 6%;
  left: 2%;
  width: 220px;
  height: 220px;
  background: url("dragon.png") no-repeat center/contain;
  z-index: 4;
  cursor: pointer;
  pointer-events: auto;
  animation: dragonFloat 7s ease-in-out infinite;
  opacity: 0.9;
  filter: drop-shadow(0 10px 18px rgba(255, 180, 100, 0.35));
}

/* Lotus */
.lotus-float {
  position: fixed;
  bottom: 4%;
  right: 8%;
  width: 140px;
  height: 140px;
  background: url("lotus.png") no-repeat center/contain;
  z-index: 4;
  cursor: pointer;
  animation: lotusFloat 6s ease-in-out infinite;
}

/* Petals */
.petals {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.petal {
  position: absolute;
  top: -10%;
  width: 16px;
  height: 12px;
  background: radial-gradient(circle at 30% 30%, #ffd7e1 0%, #f6a6bc 70%, #e88aa7 100%);
  border-radius: 70% 30% 70% 30%;
  opacity: 0.85;
  animation: fall linear infinite;
}

.petals.active .petal {
  opacity: 0.95;
  animation-duration: 5s !important;
}

.p1 { left: 10%; animation-duration: 11s; animation-delay: 0s; }
.p2 { left: 24%; animation-duration: 14s; animation-delay: 2s; }
.p3 { left: 42%; animation-duration: 12s; animation-delay: 1s; }
.p4 { left: 61%; animation-duration: 15s; animation-delay: 3s; }
.p5 { left: 79%; animation-duration: 13s; animation-delay: 1.5s; }
.p6 { left: 91%; animation-duration: 16s; animation-delay: 0.5s; }

@keyframes fall {
  0% {
    transform: translateY(-10vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  50% {
    transform: translateY(45vh) translateX(20px) rotate(120deg);
  }
  100% {
    transform: translateY(110vh) translateX(-30px) rotate(260deg);
    opacity: 0;
  }
}

@keyframes dragonFloat {
  0%   { transform: translateY(0px) translateX(0px); }
  50%  { transform: translateY(-12px) translateX(-6px); }
  100% { transform: translateY(0px) translateX(0px); }
}

@keyframes lotusFloat {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

/* Mute button */
#mute-btn {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 20;
  background: rgba(255, 250, 245, 0.92);
  border: 1px solid rgba(180, 70, 70, 0.3);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#mute-btn:hover {
  background: #f3e2e2;
}

/* Dragon popup */
.info-popup {
  position: fixed;
  top: 12%;
  left: 4%;
  width: 80%;
  max-width: 380px;
  padding: 24px 22px 20px;
  background: rgba(255, 248, 244, 0.96);
  border: 1px solid rgba(180, 70, 70, 0.18);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(60, 20, 20, 0.22);
  z-index: 10;
  backdrop-filter: blur(8px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.info-popup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.info-popup h2 {
  margin: 0 0 12px;
  color: #8b1e1e;
  font-size: 28px;
}

.info-popup p {
  margin: 0;
  color: #5a3a3a;
  font-size: 17px;
  line-height: 1.7;
}

.magic-name {
  color: #a61e4d;
  font-style: italic;
  font-weight: bold;
}

/* Lotus popup */
.lotus-popup {
  position: fixed;
  bottom: 18%;
  right: 4%;
  width: 80%;
  max-width: 320px;
  padding: 20px;
  background: rgba(255, 250, 245, 0.96);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(60, 20, 20, 0.2);
  z-index: 10;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.lotus-popup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.lotus-popup h2 {
  margin-bottom: 10px;
  color: #8b1e1e;
}

.lotus-table {
  font-size: 16px;
  line-height: 1.6;
  color: #4a2f2f;
}

.lotus-note {
  margin-top: 14px;
  font-style: italic;
  color: #7a3a3a;
}

/* Feedback popup */
.feedback-popup {
  position: fixed;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%) translateY(20px) scale(0.96);
  width: 80%;
  max-width: 360px;
  padding: 22px 20px;
  background: rgba(255, 248, 244, 0.96);
  border: 1px solid rgba(180, 70, 70, 0.18);
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(60, 20, 20, 0.22);
  z-index: 10;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.feedback-popup h2 {
  margin: 0 0 12px;
  color: #8b1e1e;
  font-size: 28px;
}

.feedback-popup p {
  margin: 0;
  color: #5a3a3a;
  font-size: 17px;
  line-height: 1.6;
}

.feedback-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

/* Common close button */
.close-popup {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 24px;
  color: #8b1e1e;
  cursor: pointer;
}

.close-popup:hover {
  opacity: 0.75;
}

/* Footer */
.app-footer {
  margin-top: 14px;
  text-align: center;
  z-index: 2;
  position: relative;
}

.music-credit {
  margin: 0 0 10px;
  font-size: 12px;
  color: #6b4a4a;
  opacity: 0.75;
}

.feedback-btn {
  background: rgba(255, 250, 245, 0.92);
  border: 1px solid rgba(180, 70, 70, 0.25);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 15px;
  color: #8b1e1e;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(60, 20, 20, 0.12);
}

.feedback-btn:hover {
  background: #f7ece8;
}

/* Mobile */
@media (max-width: 768px) {
  body {
    display: block;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px 0 24px;
    background-size: cover;
    background-position: center center;
  }

  .app {
    width: 92%;
    max-width: none;
    padding: 20px 16px;
    margin: 120px auto 12px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .chinese-title {
    font-size: 16px;
    margin-bottom: 4px;
  }

  .subtitle {
    font-size: 14px;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 14px;
  }

  .input-row {
    flex-direction: row;
    gap: 10px;
    align-items: center;
  }

  input {
    font-size: 16px;
    padding: 12px;
  }

  button {
    font-size: 16px;
    padding: 12px 16px;
  }

  #result {
    padding: 16px;
  }

  #result p {
    font-size: 16px;
    line-height: 1.5;
  }

  #chinese {
    font-size: 24px;
  }

  .dragon-float {
    width: 120px;
    height: 120px;
    top: 7%;
    left: 2%;
  }

  .lotus-float {
    width: 85px;
    height: 85px;
    bottom: 4%;
    right: 4%;
  }

  .info-popup {
    top: 7%;
    left: 4%;
    width: 82%;
    max-width: none;
    padding: 18px 16px;
  }

  .lotus-popup {
    right: 4%;
    bottom: 12%;
    width: 82%;
    max-width: none;
    padding: 16px;
  }

  .app-footer {
    width: 92%;
    margin: 8px auto 24px;
  }

  .music-credit {
    font-size: 11px;
    line-height: 1.3;
  }

  .feedback-btn {
    font-size: 14px;
    padding: 8px 16px;
  }

  #mute-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 16px;
    z-index: 20;
  }
}

  .share-row {
  margin-top: 10px;
  text-align: right; /* align to right = more natural */
}

  .share-btn {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(179, 52, 52, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  opacity: 0.9;
}

  .share-btn:hover {
  opacity: 1;
}