/*
 * Styles for the modals (Fun Fact Gift Box & Final Result)
 */

.modal,
.modalResult {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(32, 33, 36, 0.35);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px;
}

.modal.is-open,
.modalResult.is-open {
  display: flex;
}

.modalContent {
  width: 100%;
  max-width: 440px;
  border-radius: 20px;
  background-color: #ffffff;
  text-align: center;
  padding: 28px 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: relative;
  animation: modalPopIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Gift Box Pop-open Animation */
.gift-burst {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  margin-bottom: 4px;
}

.gift-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.16));
  animation: giftBurstPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.gift-box-mini {
  position: absolute;
  bottom: -2px;
  right: -6px;
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  animation: giftBurstPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
}

.gift-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gift-sparkles span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  opacity: 0;
  animation: sparkleFly 0.75s ease-out 0.1s forwards;
}

.gift-sparkles span:nth-child(1) {
  background: #4285f4;
  --tx: -54px;
  --ty: -46px;
}

.gift-sparkles span:nth-child(2) {
  background: #ea4335;
  --tx: 54px;
  --ty: -42px;
}

.gift-sparkles span:nth-child(3) {
  background: #fbbc05;
  --tx: -50px;
  --ty: 42px;
}

.gift-sparkles span:nth-child(4) {
  background: #34a853;
  --tx: 52px;
  --ty: 44px;
}

.round-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background-color: #e8f0fe;
  color: #1967d2;
  font-size: 0.85rem;
  font-weight: 700;
}

.fun-fact-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #202124;
  margin: 0;
}

.fun-fact-text {
  font-size: 1rem;
  line-height: 1.55;
  color: #3c4043;
  background: #f8f9fa;
  border-left: 4px solid #fbbc05;
  border-radius: 8px;
  padding: 14px 16px;
  width: 100%;
  text-align: left;
  animation: factFadeSlide 0.45s ease-out 0.15s both;
}

.next-round-btn,
.playAgain {
  width: 100%;
  max-width: 240px;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.next-round-btn {
  background-color: #4285f4;
  margin-top: 4px;
}

.playAgain {
  background-color: #34a853;
  margin-top: 8px;
}

.next-round-btn:hover,
.playAgain:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

.next-round-btn:active,
.playAgain:active {
  transform: scale(0.98);
}

/* Result Modal */
.result-trophy {
  font-size: 3.25rem;
  line-height: 1;
  animation: giftBurstPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modalResult .modalText {
  width: 100%;
}

.modalResult .modalText h2 {
  font-size: 1.5rem;
  color: #202124;
  margin-bottom: 6px;
}

.modalResult .result-desc {
  font-size: 0.95rem;
  color: #5f6368;
  margin-bottom: 16px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.result-stat-box {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-stat-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #5f6368;
  text-transform: uppercase;
}

.result-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #202124;
  font-variant-numeric: tabular-nums;
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes giftBurstPop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-15deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.22) rotate(8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes sparkleFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.2);
  }
}

@keyframes factFadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
