/* =========================================================================================
 * 💌 MODALS & POPUPS (WELCOME, BLOW MIC, GIFTS, FINAL LETTER)
 * ========================================================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: var(--app-height);
  background: rgba(8, 4, 18, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  position: relative;
  background: linear-gradient(145deg, #1d102e, #110822);
  border: 1.5px solid rgba(255, 215, 0, 0.45);
  border-radius: 28px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 64, 129, 0.35);
  text-align: center;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-backdrop.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 999;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-close-btn * {
  pointer-events: none;
}

.modal-badge-emoji {
  font-size: 46px;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.5));
  pointer-events: none;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffd54f;
  margin-bottom: 12px;
}

.modal-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 22px;
}

.modal-btn {
  background: linear-gradient(135deg, #ff4081, #7b1fa2);
  color: #ffffff;
  border: none;
  padding: 12px 28px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 64, 129, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}
.modal-btn:active {
  transform: scale(0.96);
}

/* =========================================================================================
 * 📜 FINAL HEARTFELT LETTER MODAL
 * ========================================================================================= */
.letter-card {
  background: #fdfbf7;
  color: #2c1a0e;
  border: 2px solid #d7ccc8;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
}
.letter-card::-webkit-scrollbar {
  width: 4px;
}
.letter-card::-webkit-scrollbar-thumb {
  background: #bcaaa4;
  border-radius: 4px;
}

.letter-title {
  font-family: 'Dancing Script', cursive;
  font-size: 26px;
  color: #880e4f;
  margin-bottom: 6px;
}

.letter-date {
  font-size: 12px;
  color: #795548;
  margin-bottom: 16px;
  border-bottom: 1px dashed #d7ccc8;
  padding-bottom: 8px;
}

.letter-body {
  font-size: 14.5px;
  line-height: 1.7;
  color: #3e2723;
  white-space: pre-line;
}

/* =========================================================================================
 * 🔔 CUTE FLOATING TOASTS
 * ========================================================================================= */
.toast-msg {
  position: fixed;
  bottom: 146px; /* Nằm trên nút "Ghé thăm đảo kế" (bottom 74px, cao tới ~60px khi chữ xuống dòng) */
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 16, 48, 0.95);
  border: 1px solid rgba(255, 128, 171, 0.6);
  color: #fff;
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 16px rgba(244, 143, 177, 0.4);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  text-align: center;
  width: max-content; /* left: 50% làm khung tự co còn nửa màn hình, chữ bị xuống dòng sớm */
  max-width: 88vw;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================================================
 * 🎁 ROYAL CELESTIAL GIFT MODAL & VOUCHER CARDS (ISLAND 4)
 * ========================================================================================= */
.gift-royal-card {
  max-width: 480px;
  background: linear-gradient(155deg, #221236, #120920);
  border: 1.8px solid rgba(255, 215, 0, 0.65);
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.85), 0 0 35px rgba(255, 64, 129, 0.45);
}

.gift-royal-card .modal-title {
  color: #ffd54f;
  font-size: 21px;
  text-shadow: 0 0 15px rgba(255, 213, 79, 0.4);
}

.gift-lead-text {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 16px;
  text-align: center;
}

.gift-hint-box {
  background: rgba(255, 215, 0, 0.1);
  border: 1px dashed rgba(255, 215, 0, 0.6);
  border-radius: 16px;
  padding: 14px 18px;
  margin: 12px 0 20px;
  text-align: center;
}

.gift-hint-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffd54f;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.gift-hint-body {
  font-size: 14px;
  color: #fff;
  font-style: italic;
}

/* VOUCHER GRID */
.voucher-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0 20px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

.voucher-grid::-webkit-scrollbar {
  width: 4px;
}
.voucher-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.4);
  border-radius: 4px;
}

.voucher-card {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 215, 0, 0.06));
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 16px;
  padding: 10px 14px;
  gap: 12px;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.voucher-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 215, 0, 0.8);
}

.voucher-icon {
  font-size: 26px;
  min-width: 36px;
  text-align: center;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.5));
}

.voucher-info {
  flex: 1;
}

.voucher-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffd54f;
  margin-bottom: 3px;
}

.voucher-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.voucher-claim-btn {
  background: linear-gradient(135deg, #ff4081, #7b1fa2);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.voucher-claim-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(255, 64, 129, 0.6);
}

.voucher-claim-btn:disabled {
  background: rgba(76, 175, 80, 0.35);
  color: #81c784;
  border: 1px solid #81c784;
  cursor: default;
  transform: none;
}

/* PROMISE CARD */
.gift-promise-card {
  background: linear-gradient(145deg, rgba(123, 31, 162, 0.25), rgba(255, 64, 129, 0.15));
  border: 1px solid rgba(255, 128, 171, 0.5);
  border-radius: 18px;
  padding: 18px 20px;
  margin: 12px 0 20px;
  text-align: center;
}

.gift-promise-seal {
  font-size: 32px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 10px rgba(255, 64, 129, 0.6));
}

.gift-promise-text {
  font-size: 14.5px;
  line-height: 1.7;
  color: #fff;
  margin-bottom: 12px;
}

.gift-promise-sign {
  font-size: 13px;
  font-weight: 700;
  color: #ffd54f;
  font-style: italic;
}

/* =========================================================================================
 * 🎪 LỄ HỘI QUÀ TẶNG (ĐẢO 4): popup quà, voucher, thẻ cào, thanh tiến độ
 * ========================================================================================= */
.gift-royal-card {
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}

.gift-modal-tag {
  display: inline-block;
  background: rgba(255, 64, 129, 0.25);
  color: #ffd54f;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
  align-self: center;
}

.gift-modal-body {
  text-align: left;
  overflow-y: auto;
  min-height: 0;
}

.gift-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.gift-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
  color: rgba(255, 255, 255, 0.85);
  padding: 9px 20px;
  font-size: 13.5px;
}

.voucher-no {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ff80ab;
  margin-bottom: 2px;
}

.voucher-card-big {
  flex-wrap: wrap;
  padding: 16px;
  border-style: dashed;
  border-width: 1.5px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.16), rgba(255, 64, 129, 0.12));
  animation: voucherPop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.voucher-card-big .voucher-icon {
  font-size: 38px;
}

.voucher-card-big .voucher-title {
  font-size: 15.5px;
}

.voucher-card-big .voucher-claim-btn {
  width: 100%;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-top: 4px;
}

@keyframes voucherPop {
  0% { transform: scale(0.6) rotate(-6deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.voucher-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: -6px 0 16px;
}

.voucher-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.voucher-dots span.on {
  background: #ffd54f;
  box-shadow: 0 0 8px rgba(255, 213, 79, 0.8);
}

.scratch-wrap {
  position: relative;
  overflow: hidden;
  min-height: 86px;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  touch-action: none;
  cursor: grab;
  transition: opacity 0.6s ease;
}

.scratch-canvas.done {
  opacity: 0;
  pointer-events: none;
}

.gift-progress-hud {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translate(-50%, -8px);
  display: flex;
  gap: 6px;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.gift-progress-hud.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.gift-chip {
  background: rgba(18, 10, 32, 0.78);
  border: 1px solid rgba(255, 213, 79, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.gift-chip.done {
  border-color: rgba(91, 227, 155, 0.8);
  color: #b9f6d2;
}

.gift-chip.locked {
  opacity: 0.6;
}

/* =========================================================================================
 * 🏮 ĐẢO ƯỚC NGUYỆN: popup viết điều ước
 * ========================================================================================= */
.wish-card {
  max-width: 440px;
  background: linear-gradient(160deg, #1d1530, #0f0b1d);
  border: 1.6px solid rgba(255, 176, 74, 0.6);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 36px rgba(255, 150, 60, 0.35);
}

.wish-card .modal-title {
  color: #ffd28a;
  text-shadow: 0 0 14px rgba(255, 176, 74, 0.45);
}

.wish-lead {
  font-size: 14px;
  line-height: 1.6;
}

.wish-text {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 244, 228, 0.08);
  border: 1px solid rgba(255, 210, 138, 0.45);
  border-radius: 14px;
  color: #fff;
  font-family: "Quicksand", sans-serif;
  font-size: 15px;
  padding: 12px 14px;
  resize: none;
  outline: none;
  margin-bottom: 10px;
}

.wish-text:focus {
  border-color: #ffb04a;
  box-shadow: 0 0 0 3px rgba(255, 176, 74, 0.2);
}

.wish-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.wish-chip {
  background: rgba(255, 176, 74, 0.14);
  border: 1px solid rgba(255, 176, 74, 0.4);
  color: #ffe2b3;
  font-family: "Quicksand", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 14px;
  cursor: pointer;
}

.wish-chip:active {
  transform: scale(0.96);
}
