/* Operación Sandri — Nivel 19 */

:root {
  --bg: #fff6f8;
  --bg-mid: #ffeef2;
  --cream: #f7efe4;
  --cream-dark: #efe3d4;
  --burgundy: #7a2f3d;
  --burgundy-deep: #5c2230;
  --pink: #f2b8c4;
  --pink-soft: #f8d4dc;
  --pink-selected: #f4c4ce;
  --text: #3d2a30;
  --muted: #7a646c;
  --white: #ffffff;
  --shadow: 0 8px 24px rgba(122, 47, 61, 0.08);
  --radius: 18px;
  --radius-sm: 14px;
  --font-display: "Caveat", cursive;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 50% 20%, #fff 0%, var(--bg-mid) 45%, var(--bg) 100%);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(20px + var(--safe-top))
    22px
    calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.35s ease;
}

.screen.is-active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header bits */
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.stamp {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--burgundy);
  border: 2px solid var(--burgundy);
  border-radius: 4px;
  padding: 4px 8px;
  transform: rotate(-8deg);
  opacity: 0.85;
  user-select: none;
}

.doodle-heart {
  width: 28px;
  height: 28px;
  color: var(--burgundy);
  opacity: 0.7;
  animation: pulseHeart 2.4s ease-in-out infinite;
}

@keyframes pulseHeart {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

/* Progress */
.progress-wrap {
  margin-bottom: 18px;
}

.progress-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--burgundy);
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  background: var(--pink-soft);
  border-radius: 999px;
  position: relative;
  overflow: visible;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), #e88a9c);
  border-radius: 999px;
  transition: width 0.45s ease;
}

.progress-gift {
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  color: var(--burgundy);
  background: var(--bg);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

/* Typography */
.display-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 11vw, 3.4rem);
  font-weight: 700;
  color: var(--burgundy);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-align: center;
  margin: 6px 0 10px;
}

.display-title.sm {
  font-size: clamp(2.1rem, 9vw, 2.7rem);
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  align-self: center;
  background: var(--pink-soft);
  color: var(--burgundy);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 6px 16px;
  border-radius: 999px;
  margin: 0 auto 18px;
}

.lead {
  text-align: center;
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 8px;
}

.body-text {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  color: var(--burgundy);
  font-weight: 700;
  line-height: 1.1;
  margin: 10px 0 10px;
  text-align: center;
}

.mission-intro {
  text-align: center;
  font-size: 0.94rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.mission-story {
  text-align: center;
  font-size: 0.94rem;
  color: var(--text);
  margin-bottom: 18px;
  white-space: pre-line;
  line-height: 1.45;
}

.photo-block {
  margin-bottom: 16px;
}

.photo-preview {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--pink-soft);
  background: rgba(255, 255, 255, 0.6);
}

.photo-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.code-block {
  margin: 14px 0 12px;
}

.envelope-msg {
  text-align: center;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--burgundy);
  line-height: 1.4;
  margin-bottom: 12px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.manual-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-list li {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--burgundy-deep);
  line-height: 1.4;
}

.giveup-msg {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--burgundy);
  margin: 8px 0 10px;
  line-height: 1.4;
}

.btn-help {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.help-panel {
  margin-top: 10px;
  background: var(--cream);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.help-text {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.4;
}

.help-panel .btn-maps {
  margin-top: 4px;
}

.face-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.face-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--pink-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--burgundy);
  font-weight: 800;
  font-size: 0.85rem;
  min-height: 48px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.face-option svg {
  width: 100%;
  max-width: 110px;
  height: auto;
}

.face-option.is-selected {
  background: var(--pink-selected);
  border-color: var(--pink-selected);
}

.face-option.is-wrong-shake {
  animation: shake 0.4s ease;
}

.love-box p {
  white-space: pre-line;
}

.question {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--burgundy);
  text-align: center;
  margin-bottom: 14px;
}

/* Illustrations */
.illu {
  display: flex;
  justify-content: center;
  margin: 8px 0 16px;
}

.illu svg {
  width: 110px;
  height: auto;
  color: var(--burgundy);
}

.illu.sm svg {
  width: 88px;
}

.illu.popper svg {
  width: 100px;
}

/* Cards */
.note-card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--burgundy-deep);
}

.note-list .icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--burgundy);
}

.clue-card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin: 8px 0 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
}

.clue-card .icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--burgundy);
  margin-top: 2px;
}

.clue-card strong {
  display: block;
  color: var(--burgundy);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.clue-card p {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.4;
}

/* Location / navigation card */
.location-card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 0 0 18px;
  text-align: left;
}

.location-card[hidden] {
  display: none !important;
}

.location-fun {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--burgundy);
  margin-bottom: 12px;
  line-height: 1.35;
  text-align: center;
}

.location-map {
  position: relative;
  height: 118px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  background:
    linear-gradient(90deg, rgba(242, 184, 196, 0.25) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(242, 184, 196, 0.25) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(145deg, #fff8fa 0%, #f3e4d8 100%);
  border: 1.5px solid var(--pink-soft);
}

.location-map-roads {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(122, 47, 61, 0.22);
}

.location-pin {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -100%);
  width: 28px;
  height: 28px;
  color: var(--burgundy);
  filter: drop-shadow(0 3px 4px rgba(122, 47, 61, 0.25));
  animation: pinBounce 1.8s ease-in-out infinite;
}

@keyframes pinBounce {
  0%,
  100% {
    transform: translate(-50%, -100%);
  }
  50% {
    transform: translate(-50%, -112%);
  }
}

.location-meta {
  margin-bottom: 12px;
}

.location-meta strong {
  display: block;
  color: var(--burgundy);
  font-size: 1rem;
  margin-bottom: 2px;
}

.location-meta span {
  display: block;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.35;
}

.btn-maps {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--burgundy);
  color: var(--white);
  font-weight: 800;
  font-size: 0.98rem;
  padding: 13px 16px;
  border-radius: 14px;
  min-height: 48px;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(122, 47, 61, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.btn-maps:active {
  background: var(--burgundy-deep);
}

.btn-maps-apple {
  display: none;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  color: var(--burgundy);
  font-weight: 800;
  font-size: 0.88rem;
  text-decoration: none;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px dashed var(--pink);
  background: rgba(255, 255, 255, 0.4);
  -webkit-tap-highlight-color: transparent;
}

.btn-maps-apple.is-visible {
  display: block;
}

/* Quiz options */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.option {
  width: 100%;
  text-align: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--pink-soft);
  background: rgba(255, 255, 255, 0.55);
  color: var(--burgundy);
  font-weight: 700;
  font-size: 0.98rem;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  min-height: 48px;
}

.option:active:not(:disabled) {
  transform: scale(0.98);
}

.option.is-selected {
  background: var(--pink-selected);
  border-color: var(--pink-selected);
}

.option.is-wrong-shake,
.code-input.is-wrong-shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* Feedback toast */
.feedback {
  min-height: 1.4em;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--burgundy);
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.feedback.is-visible {
  opacity: 1;
}

.feedback.is-error {
  color: #a33d4f;
}

.feedback.is-ok {
  color: #2f6b4f;
}

/* Code form */
.code-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.code-input {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--pink-soft);
  background: rgba(255, 255, 255, 0.7);
  color: var(--burgundy);
  font-size: 16px; /* evita zoom en iOS */
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.2s ease;
}

.code-input:focus {
  border-color: var(--pink);
}

.code-input::placeholder {
  color: #c4a0a8;
  letter-spacing: 0;
  font-weight: 600;
}

.code-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Primary CTA */
.spacer {
  flex: 1;
  min-height: 16px;
}

.btn-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--burgundy);
  color: var(--white);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 16px 20px;
  border-radius: 16px;
  min-height: 54px;
  box-shadow: 0 10px 22px rgba(122, 47, 61, 0.22);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
  background: var(--burgundy-deep);
}

.btn-primary .arrow {
  font-size: 1.15rem;
  line-height: 1;
}

.btn-ghost {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  color: var(--burgundy);
  font-weight: 800;
  font-size: 0.92rem;
  border-radius: 12px;
  border: 1.5px dashed var(--pink);
  background: rgba(255, 255, 255, 0.35);
}

/* Finale */
.finale-hearts {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 14px;
  color: var(--burgundy);
}

.finale-hearts span {
  display: inline-block;
  animation: floatY 2s ease-in-out infinite;
}

.finale-hearts span:nth-child(2) {
  animation-delay: 0.25s;
}

.finale-hearts span:nth-child(3) {
  animation-delay: 0.5s;
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.wish {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--burgundy);
  font-weight: 700;
  margin: 8px 0 12px;
}

.love-box {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 16px;
}

.love-box p {
  font-size: 0.95rem;
  color: var(--text);
}

.location-note {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--burgundy);
  margin-top: 8px;
}

/* Modal pista */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(61, 42, 48, 0.35);
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.modal.is-open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--bg);
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

.modal-sheet h3 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--burgundy);
  text-align: center;
  margin-bottom: 10px;
}

.modal-sheet p {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 18px;
}

/* Confetti canvas */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* Decor sparkles */
.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  color: var(--pink);
  opacity: 0.55;
  pointer-events: none;
}

.sparkle-1 {
  top: 12%;
  left: 8%;
  animation: twinkle 3s ease-in-out infinite;
}

.sparkle-2 {
  top: 18%;
  right: 10%;
  animation: twinkle 2.4s ease-in-out 0.6s infinite;
}

.sparkle-3 {
  bottom: 22%;
  left: 12%;
  animation: twinkle 2.8s ease-in-out 1s infinite;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.8) rotate(0deg);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.15) rotate(20deg);
  }
}

/* Provisional tag highlight in clue text */
.provisional {
  background: #ffe8a3;
  color: #6a4f00;
  font-weight: 800;
  font-size: 0.72em;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
}

@media (min-width: 480px) {
  .app {
    padding-top: 32px;
  }
}
