:root {
  --crema: #fbf4ec;
  --papel: #fffaf4;
  --rosa: #f2c4c9;
  --rosa-f: #d98a95;
  --cacao: #3f2a26;
  --texto: #5b4540;
  --oro: #c9a46a;
  --sombra: 0 10px 30px -12px rgba(63, 42, 38, .28);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--crema);
  background-image: radial-gradient(circle at 20% 0%, #fde6e6 0, transparent 45%),
                    radial-gradient(circle at 100% 40%, #fbeedd 0, transparent 40%);
  color: var(--texto);
  min-height: 100dvh;
  overflow-x: hidden;
}
main { max-width: 520px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 20px 40px; position: relative; z-index: 1; }

/* nieve suave */
.nieve { position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(#fff 1.4px, transparent 1.6px), radial-gradient(#f6d9dc 1.2px, transparent 1.4px);
  background-size: 60px 60px, 90px 90px; background-position: 0 0, 30px 40px;
  animation: nieva 30s linear infinite; opacity: .9; }
@keyframes nieva { to { background-position: 60px 600px, 120px 940px; } }

.cabecera { text-align: center; margin-bottom: 22px; }
.lazo { font-size: 34px; animation: balanceo 3s ease-in-out infinite; transform-origin: 50% 20%; }
@keyframes balanceo { 50% { transform: rotate(8deg); } }
h1 { font-family: 'Fraunces', serif; font-weight: 400; font-size: 44px; line-height: .95; color: var(--cacao); letter-spacing: -.02em; margin-top: 4px; }
h1 em { font-family: 'Caveat', cursive; font-style: normal; font-size: 64px; color: var(--rosa-f); }
.sub { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin-top: 10px; opacity: .75; }

.aviso { background: var(--papel); border: 1.5px dashed var(--rosa); border-radius: 18px; padding: 16px 18px; text-align: center; margin-bottom: 18px; box-shadow: var(--sombra); }
.aviso:empty { display: none; }
.aviso b { color: var(--cacao); }
.aviso .grande { font-family: 'Caveat', cursive; font-size: 28px; color: var(--rosa-f); display: block; line-height: 1.1; margin-bottom: 4px; }

.progreso { margin-bottom: 18px; text-align: center; font-size: 14px; }
.barra { height: 10px; background: #f3e3dc; border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.barra span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rosa), var(--rosa-f)); border-radius: 99px; transition: width 1s cubic-bezier(.2,.8,.2,1); }

/* tablero de QRs */
.tablero { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 34px; }
.tarjeta { min-width: 0; background: var(--papel); border-radius: 20px; padding: 14px 12px 12px; box-shadow: var(--sombra); text-align: center; position: relative; }
.tarjeta h3 { font-family: 'Caveat', cursive; font-size: 24px; font-weight: 700; color: var(--cacao); line-height: 1; }
.tarjeta .dias { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; margin: 2px 0 10px; }
.tarjeta svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.tarjeta .estado { font-size: 13px; margin-top: 8px; }
.tarjeta.completa { outline: 2px solid var(--oro); animation: brillo 2.4s ease-in-out infinite; cursor: pointer; }
.tarjeta.completa .estado { color: var(--rosa-f); font-weight: 700; }
@keyframes brillo { 50% { box-shadow: 0 0 0 6px rgba(201,164,106,.18), var(--sombra); } }
.pieza-nueva { animation: aparece 1.2s cubic-bezier(.2,.8,.2,1) both; transform-box: fill-box; transform-origin: center; }
@keyframes aparece { from { opacity: 0; transform: scale(.4); } }

/* polaroids */
.recuerdos h2 { font-family: 'Fraunces', serif; font-weight: 400; font-style: italic; font-size: 26px; color: var(--cacao); text-align: center; margin-bottom: 16px; }
.polas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.polas:empty::after { content: 'aquí irán apareciendo vuestras fotos ✨'; grid-column: 1 / -1; text-align: center; font-family: 'Caveat', cursive; font-size: 22px; opacity: .7; }
.pola { background: #fff; padding: 6px 6px 0; box-shadow: var(--sombra); border-radius: 3px; cursor: pointer; }
.pola img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #f3e9e2; }
.pola figcaption { font-family: 'Caveat', cursive; font-size: 17px; text-align: center; padding: 4px 2px 6px; color: var(--cacao); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.polas .pola:nth-child(3n+1) { transform: rotate(-2.5deg); }
.polas .pola:nth-child(3n+2) { transform: rotate(1.5deg) translateY(4px); }
.polas .pola:nth-child(3n) { transform: rotate(-1deg); }
.pola.bloq { background: #f7ece6; display: grid; place-items: center; aspect-ratio: .86; cursor: default; font-family: 'Fraunces', serif; color: #cdb3aa; font-size: 22px; box-shadow: none; border: 1.5px dashed #e8d3ca; }

footer { text-align: center; font-size: 12px; opacity: .55; margin-top: 40px; }

/* capas */
.capa { position: fixed; inset: 0; z-index: 10; background: rgba(63,42,38,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 18px; overflow-y: auto; animation: fundido .35s both; }
.capa[hidden] { display: none; }
.capa.blanca { background: #fff; }
@keyframes fundido { from { opacity: 0; } }
.hoja { background: var(--papel); width: 100%; max-width: 420px; border-radius: 26px; padding: 24px 22px 22px; text-align: center; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); animation: sube .55s cubic-bezier(.2,.9,.25,1.15) both; }
@keyframes sube { from { transform: translateY(40px) scale(.96); opacity: 0; } }
.dianum { font-family: 'Fraunces', serif; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; color: var(--rosa-f); margin-bottom: 14px; }
.pola.grande { width: 78%; margin: 0 auto 18px; padding: 10px 10px 0; transform: rotate(-2deg); animation: cae .9s .15s cubic-bezier(.2,.9,.25,1.2) both; }
.pola.grande figcaption { font-size: 26px; padding: 8px 4px 12px; }
@keyframes cae { from { transform: translateY(-30px) rotate(-12deg); opacity: 0; } }
.carta { font-family: 'Caveat', cursive; font-size: 25px; line-height: 1.2; color: var(--cacao); white-space: pre-line; margin-bottom: 18px; }
.trozo { display: flex; align-items: center; gap: 12px; justify-content: center; background: #fbeee9; border-radius: 16px; padding: 10px 14px; margin-bottom: 18px; font-size: 14px; text-align: left; }
.trozo svg { width: 64px; height: 64px; flex: none; border-radius: 8px; }
.boton { font: 700 15px 'DM Sans', sans-serif; color: #fff; background: var(--cacao); border: 0; border-radius: 99px; padding: 14px 26px; cursor: pointer; }
.mini { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin: 6px 0 14px; }
.qrhoja { box-shadow: none; background: #fff; }
#qrGrande svg { width: min(86vw, 380px); height: auto; display: block; margin: 0 auto; }
.sorpresa h2 { font-family: 'Fraunces', serif; font-weight: 600; font-size: 30px; color: var(--cacao); line-height: 1.05; margin-bottom: 14px; }
.semoji { font-size: 64px; margin: 4px 0 8px; animation: cae .9s .2s both; }
.confeti { font-size: 26px; letter-spacing: 8px; animation: balanceo 2s ease-in-out infinite; }
.vale { border: 2px dashed var(--oro); border-radius: 14px; padding: 12px; font-family: 'Fraunces', serif; font-style: italic; color: var(--cacao); margin-bottom: 20px; background: #fffdf8; }
