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

body {
  font-family: 'Mali', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 50% 15%, #1d1b46 0%, #0d0f26 60%, #050614 100%);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
  font-size: 15px;
}

/* Canvas pháo hoa nền full màn hình */
#fireworksCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Lồng đèn treo đung đưa */
.top-lanterns {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
  z-index: 15;
  padding-top: 2px;
}

.mini-lantern {
  font-size: 1.6rem;
  transform-origin: top center;
  animation: swing 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 2px 8px rgba(255, 100, 0, 0.7));
}

.lan-1 { animation-delay: 0s; }
.lan-2 { animation-delay: 0.5s; font-size: 1.2rem; }
.lan-3 { animation-delay: 1.2s; }
.lan-4 { animation-delay: 0.8s; font-size: 1.2rem; }
.lan-5 { animation-delay: 0.3s; }

@keyframes swing {
  0% { transform: rotate(-7deg); }
  100% { transform: rotate(7deg); }
}

/* Khung chứa giao diện điện thoại (Mobile Container) */
.mobile-wrapper {
  position: relative;
  z-index: 5;
  max-width: 480px;
  margin: 0 auto;
  padding: 45px 16px 60px;
}

/* Thanh nút tiện ích trên cùng */
.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.pill-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #fff;
  padding: 8px 12px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.pill-btn:active {
  transform: scale(0.96);
}

.music-pill.active {
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  border-color: #ff416c;
  box-shadow: 0 0 12px rgba(255, 65, 108, 0.6);
}

.fire-pill {
  background: linear-gradient(135deg, #f39c12, #d35400);
  border-color: #ffd154;
}

/* Header Vầng trăng */
.hero {
  text-align: center;
  margin-bottom: 25px;
}

.moon-box {
  width: 130px;
  height: 130px;
  margin: 0 auto 15px;
  position: relative;
}

.glowing-moon {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffde4, #ffd460, #f39c12);
  box-shadow: 0 0 35px rgba(255, 212, 96, 0.8), 0 0 70px rgba(243, 156, 18, 0.4);
  position: relative;
  animation: floatMoon 3.5s ease-in-out infinite alternate;
}

@keyframes floatMoon {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-8px); }
}

.rabbit {
  position: absolute;
  font-size: 2.5rem;
  bottom: 5px;
  right: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  animation: hop 2s infinite ease-in-out;
}

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.cloud {
  position: absolute;
  bottom: -2px;
  left: -15px;
  font-size: 1.8rem;
  opacity: 0.9;
}

.greeting-tag {
  display: inline-block;
  background: linear-gradient(90deg, #d35400, #c0392b);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.4);
}

.main-title {
  font-size: 1.7rem;
  color: #ffd154;
  text-shadow: 0 0 15px rgba(255, 209, 84, 0.6);
  margin-bottom: 4px;
}

.person-name {
  font-size: 2.2rem;
  background: linear-gradient(120deg, #ffdf78, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(255, 140, 0, 0.4);
}

.sub-joke {
  font-size: 0.9rem;
  color: #dfe6e9;
  padding: 0 10px;
}

/* Các khối Card */
.card {
  background: rgba(22, 27, 60, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 209, 84, 0.3);
  border-radius: 20px;
  padding: 20px 18px;
  margin-bottom: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

/* Profile Card */
.profile-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  padding-bottom: 14px;
}

.avatar-circle {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffeaa7, #fdcb6e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  position: relative;
  box-shadow: 0 0 15px rgba(253, 203, 110, 0.6);
  flex-shrink: 0;
}

.ear-deco {
  position: absolute;
  top: -14px;
  font-size: 1.4rem;
}

.profile-title h3 {
  font-size: 1.35rem;
  color: #ffd154;
}

.role-badge {
  display: inline-block;
  background: rgba(255, 107, 129, 0.25);
  border: 1px solid #ff6b81;
  color: #ff6b81;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 3px;
  font-weight: 700;
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 9px 12px;
  border-radius: 12px;
}

.stat-name {
  color: #dfe4ea;
}

.stat-value {
  font-weight: 700;
  text-align: right;
}

.stat-value.red { color: #ff6b81; }
.stat-value.gold { color: #ffd154; }
.stat-value.green { color: #2ed573; }

/* Game Cards */
.game-card {
  text-align: center;
}

.card-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.game-card h3 {
  font-size: 1.2rem;
  color: #ffd154;
  margin-bottom: 6px;
}

.game-desc {
  font-size: 0.85rem;
  color: #ced6e0;
  margin-bottom: 16px;
}

/* Nút né (Runaway Button) */
.touch-arena {
  position: relative;
  height: 120px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 10px;
}

.runaway-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ff4757, #e84118);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
  cursor: pointer;
  white-space: nowrap;
  transition: top 0.15s ease-out, left 0.15s ease-out;
  user-select: none;
}

.try-note {
  font-size: 0.8rem;
  color: #a4b0be;
}

.try-note strong {
  color: #ff6b81;
}

/* Nút hành động chung */
.action-btn {
  background: linear-gradient(135deg, #ffa502, #ff6348);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 99, 72, 0.4);
  width: 100%;
  transition: transform 0.15s ease;
}

.action-btn:active {
  transform: scale(0.97);
}

/* Thanh quét gương mặt */
.scan-progress-box {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 12px;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  transition: width 0.3s;
}

#scanStatusText {
  font-size: 0.8rem;
  color: #00f2fe;
}

.scan-result-card {
  margin-top: 14px;
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid #ff4757;
  border-radius: 14px;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}

/* Lưới Bánh Trung Thu */
.cake-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.cake-item {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 209, 84, 0.3);
  border-radius: 14px;
  padding: 12px 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.2s;
}

.cake-item:active {
  transform: scale(0.95);
  background: rgba(255, 209, 84, 0.2);
}

.cake-emoji {
  font-size: 1.8rem;
}

.cake-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffd154;
}

.cake-result-box {
  background: rgba(255, 234, 167, 0.15);
  border: 1px dashed #ffd154;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.9rem;
  color: #ffeaa7;
  text-align: left;
}

/* Thả đèn điều ước */
.wish-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  justify-content: center;
}

.wish-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f2f6;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.wish-tag:active {
  background: rgba(255, 209, 84, 0.3);
}

.wish-input-row {
  display: flex;
  gap: 8px;
}

.wish-input-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.wish-input-row input:focus {
  border-color: #ffd154;
}

.action-btn-small {
  background: linear-gradient(135deg, #d35400, #c0392b);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 25px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* Đèn lồng bay lên trời */
.sky-lanterns {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.floating-lantern {
  position: absolute;
  bottom: -60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: flyUp 10s linear forwards;
}

.lantern-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.9));
}

.lantern-text {
  background: rgba(192, 57, 43, 0.9);
  border: 1px solid #ffd154;
  color: #fff;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

@keyframes flyUp {
  0% { transform: translateY(0) scale(0.9); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110vh) scale(0.5); opacity: 0; }
}

/* Danh ngôn */
.quote-card {
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.25), rgba(253, 121, 168, 0.25));
}

.quote-symbol {
  font-family: serif;
  font-size: 3rem;
  color: rgba(255, 209, 84, 0.4);
  line-height: 1;
}

.quote-content {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffeedb;
  margin-bottom: 14px;
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quote-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 209, 84, 0.5);
  color: #ffd154;
  padding: 7px 16px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Footer Lời chúc thật lòng */
.footer-card {
  text-align: center;
  padding: 24px 16px;
  background: rgba(10, 12, 32, 0.85);
  border-top: 2px solid #ffd154;
  border-radius: 20px;
}

.footer-lanterns {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.footer-card h3 {
  font-size: 1.3rem;
  color: #ffd154;
  margin-bottom: 8px;
}

.real-wish {
  font-size: 0.88rem;
  color: #dfe4ea;
  margin-bottom: 18px;
  line-height: 1.6;
}

.copy-btn {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 15px;
}

.watermark {
  font-size: 0.75rem;
  color: #747d8c;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #171b3c;
  border: 2px solid #ffd154;
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(255, 209, 84, 0.3);
  animation: pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

#modalHead {
  color: #ffd154;
  font-size: 1.25rem;
  margin-bottom: 8px;
}

#modalMsg {
  font-size: 0.9rem;
  color: #f1f2f6;
  margin-bottom: 18px;
  line-height: 1.5;
}

.modal-btn {
  background: linear-gradient(135deg, #ffa502, #ff4757);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 25px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.hidden {
  display: none !important;
}
