:root {
  --red: #c8102e;
  --red-deep: #8e1b24;
  --green: #1f6b45;
  --green-deep: #15503a;
  --white: #ffffff;
  --snow: #f4f8fd;
  --ink: #2a0610;
  --gold: #ffd27a;

  --card-bg: rgba(60, 4, 16, 0.32);
  --card-border: rgba(255, 255, 255, 0.28);
  --unit-bg: rgba(255, 255, 255, 0.1);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

/* Fondo rojo navideño: degradado con un leve brillo central y bordes más oscuros */
body {
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 90, 100, 0.35), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(20, 0, 5, 0.55), transparent 60%),
    linear-gradient(180deg, #a3101f 0%, #8a0c1b 55%, #5e0914 100%);
  background-attachment: fixed;
  color: var(--white);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== Luces navideñas ===== */
.lights { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.lights svg { display: block; overflow: visible; }
.lights .wire { fill: none; stroke: #0f3b27; stroke-width: 2.2; }
.lights .cap { fill: #1f4a35; }
.lights .glass { fill: currentColor; filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 10px currentColor); }
.lights .bulb { animation: glow 2.4s ease-in-out infinite; }
.lights .b1 { animation-delay: -0.8s; }
.lights .b2 { animation-delay: -1.6s; }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ===== Decoraciones (js/decorations.js) ===== */
.decor { position: fixed; inset: 0; pointer-events: none; }
.decor svg { display: block; overflow: visible; }
.decor--back { z-index: 0; }
.decor--front { z-index: 3; }

.big-flake line { stroke: #ffffff; stroke-width: 2.5; stroke-linecap: round; opacity: 0.1; }
.big-flake > g { animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sparkle { fill: #ffe6a8; animation: sparkle 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sparkle { 0%, 100% { opacity: 0.1; transform: scale(0.6); } 50% { opacity: 0.9; transform: scale(1); } }

.tree-light { fill: currentColor; filter: drop-shadow(0 0 3px currentColor); animation: glow 2.4s ease-in-out infinite; }
.tree-star { filter: drop-shadow(0 0 6px #ffd27a); }

.ornament { animation: sway 4s ease-in-out infinite; }
.ornament-string { stroke: rgba(255, 230, 190, 0.6); stroke-width: 1; }
.ornament-ball { filter: drop-shadow(0 3px 5px rgba(40, 0, 8, 0.35)); }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* ===== Renos (js/reindeer.js) ===== */
.reindeer-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.deer-team { position: absolute; left: 0; will-change: transform; }
.deer-team svg { position: absolute; top: 0; overflow: visible; }
.deer--far { filter: brightness(0.8) saturate(0.9); }
.reins path { stroke: #ffd27a; stroke-width: 1.5; fill: none; opacity: 0.8; }
.deer { animation: gallop 0.7s ease-in-out infinite alternate; }
.deer-legs { transform-box: fill-box; transform-origin: center; animation: legs 0.7s ease-in-out infinite alternate; }
.rudolph-nose { fill: #ff2a2a; filter: drop-shadow(0 0 4px #ff2a2a) drop-shadow(0 0 10px #ff5a5a); animation: nose 1.2s ease-in-out infinite; }
@keyframes gallop { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@keyframes legs { from { transform: scaleX(0.9); } to { transform: scaleX(1.05); } }
@keyframes nose { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ===== Contenido ===== */
.content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 4vh, 40px);
  padding: clamp(72px, 12vh, 120px) clamp(36px, 5vw, 56px) 16px;
}

.card {
  width: min(640px, 100%);
  text-align: center;
  padding: clamp(22px, 4vw, 40px) clamp(14px, 4vw, 44px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 24px 60px rgba(40, 0, 8, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  position: relative;
  overflow: hidden;
}

/* Cinta blanca/verde arriba de la tarjeta */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: repeating-linear-gradient(135deg, var(--white) 0 12px, var(--green) 12px 24px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot--white { background: var(--white); box-shadow: 0 0 8px var(--white); }
.dot--green { background: #3fd47f; box-shadow: 0 0 8px #3fd47f; }

.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  line-height: 1.05;
  margin: 10px 0 clamp(18px, 3vw, 30px);
  text-shadow: 0 2px 18px rgba(40, 0, 8, 0.35);
}
.title em { font-style: italic; font-weight: 500; color: var(--gold); }

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(6px, 2vw, 16px);
}

.unit {
  background: var(--unit-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: clamp(12px, 2.4vw, 20px) 2px clamp(10px, 2vw, 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.unit:first-child {
  background: linear-gradient(180deg, rgba(31, 107, 69, 0.9), rgba(21, 80, 58, 0.9));
  border-color: rgba(120, 230, 170, 0.35);
}

.num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 7vw, 3.3rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.label {
  font-size: clamp(0.58rem, 1.6vw, 0.78rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.merry { margin-top: 12px; font-family: var(--font-display); font-size: 1.6rem; font-style: italic; }

/* ===== Santa gordito ===== */
/* Santa ocupa el espacio libre bajo la tarjeta (hasta 300px de alto), así siempre cabe en pantalla */
.santa-stage { position: relative; width: 100%; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; }
.big-santa {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 300px;
  width: 100%;              /* ancho completo: el dibujo se centra solo dentro del SVG (antes se descentraba en iPhone) */
  max-width: 340px;
  padding: 0;
  display: flex;
  justify-content: center;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 24px;
}
.big-santa:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }
.big-santa-svg {
  display: block;
  height: 100%;
  width: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 24px rgba(40, 0, 8, 0.4));
  transform-origin: 50% 100%;
  animation: breathe 2.8s ease-in-out infinite;
}
/* Animaciones propias de cada Santa: css/santas.css */
.big-santa:hover .big-santa-svg { animation: jiggle 0.5s ease-in-out infinite; }

/* Se infla con un bamboleo... */
.big-santa.is-inflating .big-santa-svg { animation: inflate 0.75s cubic-bezier(.4,0,.6,1) forwards; }
/* ...¡puf! desaparece... */
.big-santa.is-popped .big-santa-svg { animation: none; transform: scale(1.5); opacity: 0; transition: transform 0.18s ease-out, opacity 0.18s ease-out; }
/* ...y vuelve rebotando cuando se cierra la tarjeta */
.big-santa.is-back .big-santa-svg { animation: come-back 0.7s cubic-bezier(.3,1.6,.5,1); }

@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, 0.97); } }
@keyframes jiggle { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(1.07, 0.93); } 60% { transform: scale(0.96, 1.04); } }
@keyframes inflate {
  0%   { transform: scale(1, 1); }
  20%  { transform: scale(1.1, 0.92); }
  40%  { transform: scale(1.05, 1.12) rotate(-4deg); }
  60%  { transform: scale(1.22, 1.1) rotate(4deg); }
  80%  { transform: scale(1.18, 1.26) rotate(-3deg); }
  100% { transform: scale(1.34, 1.34); }
}
@keyframes come-back { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.santa-hint {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(40, 0, 8, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Confeti de la explosión alegre */
.confetti { position: absolute; left: 50%; top: 45%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.confetti span {
  position: absolute;
  left: 0; top: 0;
  line-height: 1;
  transform: translate(-50%, -50%);
  animation: fly 1.2s cubic-bezier(.2,.7,.3,1) forwards;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}
@keyframes fly {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 60px)) rotate(var(--rot)) scale(1); opacity: 0; }
}
.confetti .ring {
  position: absolute;
  left: -60px; top: -60px;
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255, 230, 170, 0.9);
  animation: ring 0.6s ease-out forwards;
}
@keyframes ring { 0% { transform: scale(0.3); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

/* ===== Tarjeta de la actividad ===== */
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 0, 8, 0.55); opacity: 0; transition: opacity 0.3s; }
.modal-panel {
  position: relative;
  width: min(420px, 100%);
  margin-top: 70px;
  padding: 90px 28px 28px;
  text-align: center;
  color: var(--ink);
  background: var(--snow);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  border-top: 6px solid var(--red);
  transform: translateY(40px) scale(0.92);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(.3,1.4,.5,1), opacity 0.3s;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-panel { transform: none; opacity: 1; }
.santa {
  position: absolute;
  left: 50%;
  top: -118px;
  width: 190px;
  transform: translateX(-50%) translateY(30px);
  transition: transform 0.5s 0.1s cubic-bezier(.3,1.6,.5,1);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25));
}
.modal.is-open .santa { transform: translateX(-50%); }
.santa svg { display: block; width: 100%; height: auto; overflow: hidden; /* solo cabeza y hombros, con los hombros desvanecidos */
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent); mask-image: linear-gradient(to bottom, #000 78%, transparent); }

/* ===== Selector de Santa (arriba a la derecha) ===== */
.santa-picker { position: fixed; top: 12px; right: 52px; z-index: 6; }
.picker-btn {
  width: 52px; height: 52px; padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 50% 35%, #fff4f4, #f1d9dc);
  box-shadow: 0 6px 18px rgba(40, 0, 8, 0.45), 0 0 0 4px rgba(255, 210, 122, 0.35);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s;
}
.picker-btn:hover { transform: scale(1.08) rotate(-6deg); }
.picker-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.picker-face { display: block; width: 100%; height: 100%; }
.picker-face svg { display: block; width: 118%; height: auto; margin: 2px 0 0 -6%; }
.picker-panel {
  position: fixed;               /* anclado a la pantalla para que nunca se salga por los lados */
  top: 74px; right: 16px;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px);
  overflow-y: auto;                /* con 22 Santas el panel puede ser más alto que la pantalla */
  overscroll-behavior: contain;
  padding: 14px;
  border-radius: 20px;
  background: rgba(70, 6, 20, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(20, 0, 4, 0.5);
  animation: pop-in 0.2s ease-out;
}
.picker-panel[hidden] { display: none; }
.picker-title { font-family: var(--font-display); font-size: 1.15rem; text-align: center; margin-bottom: 10px; }
.picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.picker-option {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 2px 6px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font: 600 0.72rem var(--font-body);
  cursor: pointer;
}
.picker-option svg { width: min(60px, 100%); height: auto; }
.picker-option span { text-align: center; line-height: 1.15; }
.picker-option:hover { background: rgba(255, 255, 255, 0.16); }
.picker-option[aria-pressed="true"] { border-color: var(--gold); background: rgba(255, 210, 122, 0.18); }
.picker-option:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--green); }
.modal-title { font-family: var(--font-display); font-size: 2rem; margin: 6px 0 10px; color: var(--red-deep); }
.modal-text { font-size: 1.1rem; line-height: 1.5; color: #24324d; }
.modal-close {
  margin-top: 22px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font: 600 1rem var(--font-body);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(31, 107, 69, 0.35);
}
.modal-close:hover { background: var(--green-deep); }
.modal-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Pantallas bajas (laptops pequeñas): menos espacio para que Santa y su etiqueta quepan */
@media (max-height: 700px) {
  .content { padding-top: 60px; gap: 10px; }
  .card { padding-top: 18px; padding-bottom: 18px; }
  .title { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .lights .bulb, .big-santa-svg,
  .big-flake > g, .sparkle, .tree-light, .ornament,
  .santa-svg *, .picker-panel { animation: none !important; }
}
