/* ========== Carta a Santa · estilos compartidos ========== */
:root {
  --night: #0a1f2e;
  --pine: #0f3d2e;
  --pine-2: #165a42;
  --red: #c62833;
  --red-2: #9d1822;
  --gold: #f4c542;
  --cream: #fffaf0;
  --paper: #fdf3dc;
  --ink: #2b2420;
  --muted: #7d6e58;
  --ok: #1f7a4d;
  --warn: #c98a12;
  --radius: 20px;
  --shadow: 0 14px 40px rgba(0, 0, 0, .35);
  --font: 'Nunito', 'Quicksand', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Mountains of Christmas', 'Segoe Script', 'Brush Script MT', cursive;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(198, 40, 51, .35), transparent 60%),
    radial-gradient(900px 600px at 100% 10%, rgba(244, 197, 66, .14), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--pine) 70%, #0b2f23 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  padding-top: 34px;
}
body::after { /* nieve acumulada abajo */
  content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: 36px; pointer-events: none; z-index: 1;
  background: radial-gradient(40px 22px at 20px 36px, #fff 98%, transparent) 0 0/60px 36px repeat-x;
  opacity: .9;
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* ----- luces navideñas ----- */
.lights {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 50; pointer-events: none;
  display: flex; justify-content: space-around; align-items: flex-start;
  background: linear-gradient(#0000 0 0);
}
.lights::before { /* cable */
  content: ''; position: absolute; left: -5%; right: -5%; top: 4px; height: 10px;
  border-bottom: 2px solid #1b1b1b; border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.bulb {
  position: relative; top: 8px; width: 12px; height: 18px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c); box-shadow: 0 0 12px 3px var(--c); animation: blink 2.4s ease-in-out infinite;
}
.bulb::before { content: ''; position: absolute; top: -5px; left: 3px; width: 6px; height: 6px; background: #333; border-radius: 2px; }
@keyframes blink { 0%, 100% { opacity: 1; filter: brightness(1.15); } 50% { opacity: .35; filter: brightness(.7); } }

/* ----- layout ----- */
.topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 880px; margin: 0 auto; padding: 14px 16px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand .logo { font-size: 30px; animation: bob 3s ease-in-out infinite; display: inline-block; }
.brand span.t { font-family: var(--font-title); font-size: 30px; font-weight: 700; text-shadow: 0 2px 0 var(--red-2), 0 0 18px rgba(244, 197, 66, .5); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-5px) rotate(6deg); } }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 0; cursor: pointer; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 20px; backdrop-filter: blur(6px);
  transition: transform .15s, background .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .25); transform: scale(1.08); }
.icon-btn.off { opacity: .55; }

main { position: relative; z-index: 5; max-width: 880px; margin: 0 auto; padding: 8px 14px 70px; }

.card {
  background: var(--cream); border-radius: var(--radius); padding: 22px 20px; margin: 16px 0;
  box-shadow: var(--shadow); position: relative;
  animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.card::before { /* cinta superior */
  content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 5px; border-radius: 0 0 6px 6px;
  background: repeating-linear-gradient(45deg, var(--red) 0 14px, var(--cream) 14px 22px, var(--ok) 22px 36px, var(--cream) 36px 44px);
}
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.15; }
h1 { font-family: var(--font-title); font-size: clamp(32px, 7vw, 46px); color: var(--red); }
h2 { font-family: var(--font-title); font-size: clamp(26px, 5.5vw, 32px); color: var(--pine); }
h3 { font-size: 18px; color: var(--pine); }
p { line-height: 1.5; margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ----- formularios ----- */
label.lbl { display: block; font-weight: 800; margin: 14px 0 6px; color: var(--pine); font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; /* 16px evita zoom en iOS */
  border: 2px solid #e6d7b3; border-radius: 14px; background: #fff; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ok); box-shadow: 0 0 0 4px rgba(31, 122, 77, .18); }
textarea { resize: vertical; min-height: 110px; line-height: 1.45; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 16px;
  padding: 13px 24px; border-radius: 999px; color: #fff; background: var(--ok);
  box-shadow: 0 4px 0 #14583a, 0 8px 18px rgba(0, 0, 0, .2);
  transition: transform .12s, box-shadow .12s, filter .2s; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #14583a; }
.btn.red { background: var(--red); box-shadow: 0 4px 0 var(--red-2), 0 8px 18px rgba(0, 0, 0, .2); }
.btn.gold { background: var(--gold); color: #5a3d00; box-shadow: 0 4px 0 #b88b10, 0 8px 18px rgba(0, 0, 0, .2); }
.btn.ghost { background: transparent; color: var(--pine); box-shadow: inset 0 0 0 2px var(--pine); }
.btn.sm { padding: 8px 14px; font-size: 14px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.4); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.chip.ok { background: #d8f2e3; color: #11613a; }
.chip.wait { background: #fff0c9; color: #8a5a00; }
.chip.err { background: #fbd9dc; color: #8d1520; }
.chip.info { background: #dfeaf7; color: #1d4a7a; }

/* ----- progreso ----- */
.progress { height: 16px; background: #eadfc3; border-radius: 999px; overflow: hidden; position: relative; }
.progress > i {
  display: block; height: 100%; border-radius: 999px; width: 0; transition: width .6s cubic-bezier(.2, .8, .2, 1);
  background: repeating-linear-gradient(45deg, var(--red) 0 12px, #fff 12px 24px);
  background-size: 34px 34px; animation: stripes 1.2s linear infinite;
}
@keyframes stripes { to { background-position: 34px 0; } }

/* ----- toasts ----- */
#toasts { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  background: #1d1d1d; color: #fff; padding: 12px 18px; border-radius: 14px; max-width: 460px; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: toastIn .35s ease both; pointer-events: auto;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }

/* ----- modal ----- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
.modal { background: var(--cream); border-radius: var(--radius); padding: 24px 20px; max-width: 440px; width: 100%; box-shadow: var(--shadow); animation: rise .35s both; }
@keyframes fade { from { opacity: 0; } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  #snow { display: none; }
}

@media (max-width: 520px) {
  .card { padding: 20px 14px; margin: 12px 0; }
  .brand span.t { font-size: 26px; }
  .btn { padding: 12px 18px; }
}
