/* ============================================
   Act 4 — Treasure Hunt & Gift Reveal
   ============================================ */

#act-gift {
  background: var(--purple-deep);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--section-padding) var(--gap-lg);
  position: relative;
}

/* Padlock progress */
.padlock-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: var(--gap-lg);
  font-size: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 400px;
}

.riddle-number {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--gap-md);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.padlock {
  transition: all var(--duration-normal) var(--ease-default);
}

.padlock.unlocked {
  filter: drop-shadow(0 0 8px var(--gold-bright));
}

/* CSS Treasure Chest */
.chest-container {
  position: relative;
  width: 200px;
  height: 160px;
  margin: var(--gap-lg) auto;
  cursor: pointer;
}

.chest-body {
  width: 200px;
  height: 100px;
  background: linear-gradient(135deg, #8B6914 0%, #B8860B 30%, #DAA520 50%, #B8860B 70%, #8B6914 100%);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  position: absolute;
  bottom: 0;
  border: 3px solid #6B4F10;
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.3), 0 5px 15px rgba(0, 0, 0, 0.4);
}

.chest-body::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  background: var(--gold-bright);
  border-radius: 50%;
  border: 3px solid #6B4F10;
  box-shadow: 0 0 10px var(--glow-bright);
}

.chest-lid {
  width: 210px;
  height: 70px;
  background: linear-gradient(135deg, #8B6914 0%, #B8860B 30%, #DAA520 50%, #B8860B 70%, #8B6914 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: absolute;
  bottom: 95px;
  left: -5px;
  border: 3px solid #6B4F10;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.2);
  transform-origin: bottom center;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chest-container.open .chest-lid {
  transform: rotateX(-110deg);
}

/* Chest glow pulse — heartbeat (§3.5) */
@keyframes chest-heartbeat {
  0%, 100% { 
    box-shadow: 0 0 20px var(--glow-bright);
    transform: scale(1); 
  }
  15% { 
    box-shadow: 0 0 40px var(--glow-bright), 0 0 60px var(--glow);
    transform: scale(1.02); 
  }
  30% { 
    box-shadow: 0 0 20px var(--glow-bright);
    transform: scale(1); 
  }
  45% { 
    box-shadow: 0 0 35px var(--glow-bright), 0 0 50px var(--glow);
    transform: scale(1.015); 
  }
  60% { 
    box-shadow: 0 0 20px var(--glow-bright);
    transform: scale(1); 
  }
}

.chest-container.ready {
  animation: chest-heartbeat 1.8s ease-in-out infinite;
}

.chest-container.open {
  animation: none;
}

/* Intro message */
.gift-intro {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  color: var(--text-primary);
  text-align: center;
  max-width: var(--content-narrow);
  margin-bottom: var(--gap-xl);
  opacity: 0;
}

/* Riddle container */
.riddle-container {
  width: 100%;
  max-width: var(--content-narrow);
  margin: 0 auto;
  text-align: center;
}

.riddle-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-primary);
  margin-bottom: var(--gap-lg);
}

/* Scramble tiles */
.scramble-tiles {
  display: flex;
  justify-content: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
  flex-wrap: wrap;
}

.scramble-tile {
  width: 48px;
  height: 48px;
  background: var(--bg-soft);
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
  user-select: none;
}

.scramble-tile:hover {
  background: rgba(160, 120, 72, 0.1);
  transform: translateY(-2px);
}

.scramble-tile.selected {
  background: var(--gold);
  color: #FFFFFF;
}

.scramble-tile.locked {
  background: var(--gold-bright);
  color: #FFFFFF;
  box-shadow: 0 0 10px var(--glow-bright);
  cursor: default;
}

/* Phrase mode — wider tiles for full words */
.phrase-tiles {
  flex-direction: column;
  align-items: center;
}

.word-tile {
  width: auto;
  min-width: 80px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  text-transform: none;
  height: auto;
}

.word-slot {
  width: auto;
  min-width: 60px;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem;
  height: auto;
}

.padlock.skipped {
  opacity: 0.4;
}

.scramble-answer {
  display: flex;
  justify-content: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-lg);
  min-height: 52px;
}

.scramble-answer-slot {
  width: 48px;
  height: 48px;
  border: 2px dashed var(--text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold);
  opacity: 0.5;
  transition: all var(--duration-fast) var(--ease-default);
}

.scramble-answer-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  opacity: 1;
}

/* MC riddle options */
.riddle-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.riddle-option {
  background: var(--bg-warm);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  min-height: 48px;
}

.riddle-option:hover {
  border-color: var(--gold);
}

/* Text/Number input riddles */
.riddle-input-group {
  display: flex;
  gap: var(--gap-md);
  justify-content: center;
  margin-bottom: var(--gap-lg);
}

.riddle-input {
  background: var(--bg-warm);
  border: 1.5px solid var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  width: 250px;
  text-align: center;
  transition: border-color var(--duration-fast) var(--ease-default);
}

.riddle-input:focus {
  border-color: var(--gold);
  outline: none;
}

.riddle-input.correct {
  font-family: var(--font-handwriting);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

/* Emoji grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-md);
  max-width: 300px;
  margin: 0 auto var(--gap-lg);
}

.emoji-option {
  font-size: 2rem;
  padding: 1rem;
  background: var(--bg-warm);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.emoji-option:hover {
  border-color: var(--gold);
  transform: scale(1.1);
}

.emoji-option.selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 20px var(--glow-bright);
  transform: scale(1.15);
}

/* Hint & skip */
.riddle-hint {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: var(--gap-md);
  margin-bottom: var(--gap-md);
  opacity: 1;
}

.riddle-skip {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: var(--gap-sm);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-default);
  cursor: pointer;
  text-decoration: underline;
}

.riddle-skip.visible {
  opacity: 0.7;
}

.riddle-skip:hover {
  opacity: 1;
}

/* Reveal card */
.reveal-card {
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  padding: var(--gap-xl);
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(160, 120, 72, 0.15);
  opacity: 0;
}

.reveal-card .reveal-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: var(--gap-md);
}

.reveal-card .reveal-message {
  font-family: var(--font-body);
  color: var(--text-secondary);
  margin-bottom: var(--gap-lg);
}

.reveal-card .reveal-amount {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  color: var(--gold-bright);
  text-shadow: 0 0 30px var(--glow-bright);
  margin-bottom: var(--gap-lg);
}

.reveal-buttons {
  display: flex;
  gap: var(--gap-md);
  justify-content: center;
  flex-wrap: wrap;
}

.reveal-card .claim-btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  background: var(--gold);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-default);
}

.reveal-card .claim-btn:hover {
  background: var(--gold-bright);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--glow-bright);
}

.reveal-card .claim-btn-paypal {
  background: var(--purple);
}

.reveal-card .claim-btn-paypal:hover {
  background: var(--purple-soft);
  box-shadow: 0 4px 20px var(--glow-purple);
}

.reveal-card .disclaimer {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--gap-md);
  opacity: 0.7;
}

/* Mobile */
@media (max-width: 480px) {
  .riddle-options {
    grid-template-columns: 1fr;
  }

  .riddle-input {
    width: 100%;
  }

  .scramble-tile {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .scramble-answer-slot {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
}
