/* ============================================================
   Regalos de Navidad para Aroa — estilo "libreta de cuadritos"
   Tinta de boli azul + rotuladores rojo, verde y subrayador rosa,
   sobre una hoja pegada con celo encima de una cartulina rosa.
   ============================================================ */

:root {
  --ink: #22408F;          /* boli azul */
  --red: #D7263D;          /* rotulador rojo */
  --green: #2F8A4E;        /* rotulador verde abeto */
  --pink: #FF8FC8;         /* subrayador rosa */
  --yellow: #F5C02B;       /* estrella */
  --paper: #FCFAF3;        /* hoja de libreta */
  --grid: rgba(110, 150, 196, .20);
  --margin-line: rgba(226, 104, 104, .55);
  --card: #F2C9CF;         /* cartulina rosa */

  --hand: "Gochi Hand", "Patrick Hand", "Comic Sans MS", cursive;
  --body: "Patrick Hand", "Comic Sans MS", cursive;

  --sq: 24px;              /* tamaño del cuadrito */
  --margin-x: 2.4rem;      /* línea roja del margen */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--body);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--ink);
  /* cartulina con textura de papel */
  background-color: var(--card);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .25  0 0 0 0 .3  0 0 0 .16 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px dashed var(--red); outline-offset: 6px; border-radius: 4px; }

/* ---------- Hoja de libreta ---------- */
.sheet {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 72px 1.25rem 0 calc(var(--margin-x) + 1rem);
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent calc(var(--margin-x) - 1px), var(--margin-line) calc(var(--margin-x) - 1px), var(--margin-line) calc(var(--margin-x) + 1px), transparent calc(var(--margin-x) + 1px)),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .4  0 0 0 0 .35  0 0 0 0 .3  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 100% 100%, var(--sq) var(--sq), var(--sq) var(--sq), 160px 160px;
  background-position: 0 0, 0 10px, 10px 0, 0 0;
}

.tape { display: none; }

@media (min-width: 720px) {
  .sheet {
    width: min(600px, 92vw);
    margin: 48px auto 56px;
    min-height: calc(100vh - 104px);
    padding: 84px 2.5rem 0 calc(var(--margin-x) + 1.6rem);
    transform: rotate(-0.6deg);
    box-shadow: 0 2px 0 rgba(34, 64, 143, .06), 0 18px 40px -18px rgba(80, 20, 40, .45);
  }
  .tape {
    display: block;
    position: absolute;
    top: -14px;
    width: 120px; height: 34px;
    background: rgba(255, 214, 102, .55);
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px);
    clip-path: polygon(3% 8%, 97% 0, 100% 50%, 96% 100%, 2% 94%, 0 45%);
  }
  .tape-l { left: -18px; transform: rotate(-24deg); }
  .tape-r { right: -18px; transform: rotate(22deg); background-color: rgba(183, 156, 232, .55); }
}

/* ---------- Guirnalda ---------- */
.garland {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;
  pointer-events: none;
}
.garland svg { display: block; }
.bulb { animation: glow 2.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- Botón de idioma (esquina) ---------- */
.lang-toggle.sk {
  position: absolute;
  top: 66px; right: 1rem;
  z-index: 3;
  padding: .2rem .8rem;
  font-family: var(--hand);
  font-size: 1.05rem;
  background: none;
  border: 0;
}
@media (min-width: 720px) { .lang-toggle { right: 1.5rem; } }

/* ---------- Marcos garabateados ---------- */
.sk { position: relative; isolation: isolate; }
.sk > .sk-frame {
  position: absolute;
  left: -8px; top: -8px;
  z-index: -1;
  pointer-events: none;
  overflow: visible;
}

/* ---------- Pantallas ---------- */
.screen[hidden] { display: none !important; }
.screen { position: relative; z-index: 2; }

/* 0. Idioma */
.screen-lang { text-align: center; padding-top: 1.5rem; }

.name {
  position: relative;
  display: inline-block;
  margin: .6rem auto 0;
  font-family: var(--hand);
  font-size: clamp(5.2rem, 26vw, 7.5rem);
  line-height: .9;
  color: var(--red);
  transform: rotate(-4deg);
}
.name-word { position: relative; z-index: 1; }
.name-hat {
  position: absolute;
  z-index: 2;
  width: .82em;
  left: -.3em; top: -.42em;
  transform: rotate(-18deg);
}
.name-underline {
  position: absolute;
  left: 2%; bottom: -.02em;
  width: 100%; height: .28em;
  z-index: 0;
  opacity: .85;
}

.lang-q {
  margin: 2.2rem 0 1.4rem;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.65rem;
  line-height: 1.15;
}
.lang-q span { display: block; }
.lang-q span + span { color: var(--green); }

.lang-buttons {
  display: grid;
  gap: 1.4rem;
  max-width: 21rem;
  margin: 0 auto;
}

.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  min-height: 4.6rem;
  padding: .6rem 1.2rem;
  border: 0;
  background: none;
  font-family: var(--hand);
  font-size: 2.1rem;
  line-height: 1;
}
.btn-doodle { width: 1.6rem; display: inline-block; flex: none; }
.big-btn:nth-child(2) .btn-doodle { transform: rotate(18deg); }

/* Pequeño tambaleo al pasar o pulsar */
@media (hover: hover) {
  .big-btn:hover, .budget:hover, .lang-toggle:hover, .aroa-link:hover { animation: wobble .55s ease-in-out; }
}
.big-btn:active, .budget:active, .lang-toggle:active { animation: wobble .4s ease-in-out; }
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-2.2deg) scale(1.02); }
  60% { transform: rotate(1.6deg) scale(1.02); }
}

/* 1. Inicio */
.screen-home { padding-top: 1.6rem; }

.title {
  position: relative;
  margin: 1.4rem 0 .4rem;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 3.4rem);
  line-height: 1.02;
  color: var(--ink);
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.title .hl {
  /* subrayador rosa detrás de todo el título */
  background-image: linear-gradient(176deg, transparent 52%, rgba(255, 143, 200, .55) 52%, rgba(255, 143, 200, .55) 88%, transparent 88%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 .15em;
}
.title-hat {
  position: absolute;
  width: 3.2rem;
  left: -1.55rem; top: -1.55rem;
  transform: rotate(-20deg);
  pointer-events: none;
}

.hello {
  margin: .9rem 0 0;
  font-size: 1.35rem;
}

.question {
  margin: 1.8rem 0 1rem;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.15;
  color: var(--red);
}

.budgets {
  list-style: none;
  margin: 0;
  padding: 0 .4rem 0 0;
  display: grid;
  gap: 1.05rem;
}
.budget {
  width: 100%;
  min-height: 3.9rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .45rem 1rem .45rem .7rem;
  border: 0;
  background: none;
  text-align: left;
}
.budget .d-check { width: 2.2rem; height: 2.2rem; flex: none; overflow: visible; }
.budget .tick { stroke-dasharray: 60; stroke-dashoffset: 60; transition: stroke-dashoffset .35s ease-out; }
.budget.ticked .tick { stroke-dashoffset: 0; }
.b-label { font-family: var(--hand); font-size: 1.7rem; line-height: 1; flex: 1; }
.b-count { font-size: 1.1rem; opacity: .8; white-space: nowrap; }

.aroa-link {
  display: block;
  margin: 2.2rem 0 0 auto;
  padding: .3rem .2rem;
  border: 0;
  background: none;
  font-size: 1rem;
  opacity: .55;
  text-decoration: underline wavy rgba(34, 64, 143, .4);
  text-underline-offset: 4px;
}

/* ---------- Botones y enlaces comunes ---------- */
.link-btn {
  border: 0;
  background: none;
  padding: .3rem 0;
  font-family: var(--body);
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: underline wavy rgba(34, 64, 143, .45);
  text-underline-offset: 4px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: .35rem 1.05rem;
  border: 0;
  background: none;
  font-family: var(--hand);
  font-size: 1.35rem;
  line-height: 1.05;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
}
.btn[disabled] { opacity: .55; cursor: progress; }
@media (hover: hover) { .btn:hover { animation: wobble .55s ease-in-out; } }
.btn:active { animation: wobble .4s ease-in-out; }

.aroa-banner {
  margin: 1.2rem 0 0;
  padding: .7rem .9rem;
  background: rgba(183, 156, 232, .25);
  border-left: 4px solid #B79CE8;
  font-size: 1.15rem;
}
.aroa-banner[hidden] { display: none; }
.aroa-banner .link-btn { display: block; font-size: 1rem; }
.aroa-link[hidden] { display: none; }

/* 2. Regalos */
.screen-gifts { padding-top: 1.2rem; }
.back-btn { display: inline-flex; align-items: center; gap: .45rem; font-size: 1.2rem; text-decoration: none; }
.back-btn span:last-child { text-decoration: underline wavy rgba(34, 64, 143, .45); text-underline-offset: 4px; }
.back-arrow { width: 1.9rem; display: inline-block; }
.back-arrow svg { display: block; width: 100%; height: auto; }
.back-bottom { margin-top: 1.4rem; }
.gifts-title {
  margin: .9rem 0 .1rem;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(2.5rem, 11vw, 3.2rem);
  line-height: 1;
  color: var(--red);
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.gifts-title:focus { outline: none; }
.prices-note { margin: .6rem 0 0; font-size: 1.05rem; opacity: .75; }

.empty { margin: 1.4rem 0 .4rem; }
.empty[hidden] { display: none; }
.empty-title { font-family: var(--hand); font-size: 1.6rem; color: var(--green); margin: 0 0 .3rem; }
.empty p { margin: 0 0 .6rem; }
.empty-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .9rem; }

.gift-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0 .4rem 0 0;
  display: grid;
  gap: 1.6rem;
}
.gift {
  display: grid;
  grid-template-columns: 3.6rem 1fr;
  gap: .2rem .8rem;
  padding: 1rem .95rem 1.1rem .8rem;
}
.g-icon { display: block; width: 3.6rem; }
@media (min-width: 420px) {
  .gift { grid-template-columns: 4.4rem 1fr; gap: .2rem 1rem; }
  .g-icon { width: 4.4rem; }
}
.g-icon svg { display: block; width: 100%; height: auto; overflow: visible; }
.gift:nth-child(odd) .g-icon { transform: rotate(-5deg); }
.g-body { min-width: 0; }
.g-name {
  margin: 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.08;
}
.g-price { margin: .35rem 0 0; font-size: 1.15rem; }
.g-price strong { font-weight: 400; color: var(--red); font-size: 1.25rem; }
.g-store { opacity: .8; }
.g-details { margin: .35rem 0 0; font-size: 1.12rem; line-height: 1.3; }
.g-note { margin: .45rem 0 0; font-size: 1.05rem; color: var(--green); }
.g-nolink { margin: 0; font-size: 1.05rem; flex-basis: 100%; }
.g-code { margin: .4rem 0 0; font-size: 1.05rem; }
.g-partners { margin: .5rem 0 0; font-size: 1.08rem; }
.g-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .9rem 1.1rem; margin-top: 1rem; padding-left: .2rem; }
.g-actions .btn { flex: 1 1 6.5rem; max-width: 15rem; padding-left: .5rem; padding-right: .5rem; font-size: 1.22rem; }
.code-chip { white-space: nowrap; font-family: var(--hand); font-size: 1.15rem; }

.stamp {
  display: inline-block;
  margin: .7rem 0 0;
  padding: .15rem .7rem;
  border: 3px solid var(--red);
  border-radius: 6px 10px 5px 12px;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--red);
  transform: rotate(-5deg);
  background: rgba(255, 255, 255, .7);
}
.stamp-mine { border-color: var(--green); color: var(--green); }
.gift.tappable { cursor: pointer; }
.gift.taken .g-icon,
.gift.taken .g-name,
.gift.taken .g-price,
.gift.taken .g-details { opacity: .45; }
.gift.taken .g-icon { filter: grayscale(1); }
.gift.taken .sk-fill { fill: #F1EFE8; }

/* ---------- Ventanas ---------- */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.modal-wrap[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(34, 40, 80, .45); }
.modal {
  position: relative;
  width: min(26rem, 100%);
  transform: rotate(-.6deg);
  animation: pop .28s ease-out;
}
.modal-body {
  max-height: calc(100vh - 3rem);
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  padding: 1.3rem 1.2rem 1.3rem;
}
@keyframes pop { from { transform: scale(.92) rotate(-2deg); opacity: 0; } to { transform: scale(1) rotate(-.6deg); opacity: 1; } }
.modal p { margin: .5rem 0 0; }
.m-title { margin: 0; font-family: var(--hand); font-weight: 400; font-size: 1.85rem; line-height: 1.05; color: var(--red); }
.m-gift { display: flex; align-items: center; gap: .7rem; font-size: 1.25rem; }
.m-gift strong { font-weight: 400; font-family: var(--hand); font-size: 1.4rem; line-height: 1.1; }
.m-icon { width: 3rem; flex: none; display: block; }
.m-icon svg { display: block; width: 100%; height: auto; overflow: visible; }
.m-label { display: block; margin-top: 1rem; font-size: 1.15rem; }
.modal input[type=text] {
  width: 100%;
  margin-top: .3rem;
  padding: .55rem .7rem;
  border: 2.5px solid var(--ink);
  border-radius: 6px 9px 4px 8px;
  background: #fff;
  font: inherit;
  font-size: 1.25rem;
  color: var(--ink);
}
.modal input[type=text]:focus { outline: 3px dashed var(--pink); outline-offset: 2px; }
.m-help { font-size: 1.02rem; opacity: .8; }
.m-check { display: flex; gap: .6rem; align-items: flex-start; margin-top: 1rem; font-size: 1.12rem; cursor: pointer; }
.m-check input { width: 1.35rem; height: 1.35rem; margin: .1rem 0 0; accent-color: var(--red); flex: none; }
.m-error { color: var(--red); min-height: 0; }
.m-error:empty { display: none; }
.m-code {
  margin: .8rem 0 0;
  padding: .5rem .8rem;
  font-family: var(--hand);
  font-size: 1.9rem;
  letter-spacing: .06em;
  text-align: center;
  background: #FFF3A6;
  transform: rotate(-1.5deg);
  user-select: all;
}
.m-actions { display: flex; flex-wrap: wrap; gap: .9rem 1rem; margin-top: 1.3rem; }
body.modal-open { overflow: hidden; }

/* ---------- Confeti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.bit { position: fixed; display: block; }
.bit-0 { width: 9px; height: 14px; border-radius: 2px; }
.bit-1 { width: 10px; height: 10px; border-radius: 50%; }
.bit-2 { width: 16px; height: 16px; }
.bit-2 svg { display: block; width: 100%; height: 100%; }

/* ---------- Escena con dibujitos al pie de la hoja ---------- */
.scene {
  position: relative;
  margin: auto calc(-1.25rem) 0 calc(-1 * (var(--margin-x) + 1rem));
  height: 168px;
  pointer-events: none;
  flex: none;
}
@media (min-width: 720px) {
  .scene { margin: auto -2.5rem 0 calc(-1 * (var(--margin-x) + 1.6rem)); height: 190px; }
}
.screen { padding-bottom: 2rem; }
.sc { position: absolute; bottom: 18px; display: block; }
.sc svg, .desk-item svg, .btn-doodle svg, .title-hat svg, .name-hat svg { display: block; width: 100%; height: auto; overflow: visible; }
.sc-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; display: block; }
.sc-ground svg { width: 100%; height: 100%; display: block; }
.sc-tree { left: 50%; width: 112px; margin-left: -56px; bottom: 16px; }
.sc-p1 { left: calc(50% + 34px); width: 46px; bottom: 12px; }
.sc-p2 { left: calc(50% - 82px); width: 40px; bottom: 12px; }
.sc-ginger { left: 6%; width: 54px; }
.sc-candy { left: calc(6% + 58px); width: 26px; bottom: 16px; transform: rotate(8deg); }
.sc-snowman { right: 5%; width: 72px; bottom: 12px; }

.sway { transform-origin: 50% 100%; animation: sway 4.5s ease-in-out infinite; }
.sway-b { animation-duration: 5.2s; animation-delay: -1.7s; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.bob { animation: bob 3.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.82) rotate(12deg); opacity: .75; } }

/* ---------- Cosas sueltas sobre la cartulina (solo ordenador) ---------- */
.desk { display: none; }
@media (min-width: 980px) {
  .desk { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
  .desk-item { position: absolute; display: block; }
  .di-1 { width: 64px; left: 9%; top: 14%; animation: sway 6s ease-in-out infinite; transform-origin: 50% 0; }
  .di-2 { width: 54px; right: 10%; top: 22%; animation: sway 7s ease-in-out infinite -2s; transform-origin: 50% 0; }
  .di-3 { width: 46px; left: 13%; bottom: 16%; transform: rotate(-16deg); }
  .di-4 { width: 34px; right: 15%; bottom: 30%; }
  .di-5 { width: 48px; right: 7%; bottom: 10%; animation: sway 6.5s ease-in-out infinite -1s; transform-origin: 50% 0; }
  .di-6 { width: 26px; left: 18%; top: 48%; }
}

/* ---------- Nieve ---------- */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.flake {
  position: absolute;
  top: -30px;
  display: block;
  animation: fall var(--dur) linear infinite;
  animation-delay: var(--delay);
  will-change: transform;
}
.flake-in { display: block; width: 100%; height: 100%; animation: drift calc(var(--dur) / 3) ease-in-out infinite alternate; }
.flake svg { display: block; width: 100%; height: 100%; }
@keyframes fall { from { transform: translateY(0) rotate(0); } to { transform: translateY(110vh) rotate(200deg); } }
@keyframes drift { from { transform: translateX(calc(var(--sway) * -1)); } to { transform: translateX(var(--sway)); } }

/* ---------- Aviso (pósit) ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 1.2rem;
  z-index: 10;
  max-width: 20rem;
  padding: .8rem 1.1rem;
  background: #FFF3A6;
  box-shadow: 0 8px 18px -10px rgba(60, 30, 20, .55);
  font-size: 1.2rem;
  transform: translate(-50%, calc(100% + 3rem)) rotate(-2deg);
  visibility: hidden;
  transition: transform .35s ease, visibility 0s linear .35s;
}
.toast.show { transform: translate(-50%, 0) rotate(-2deg); visibility: visible; transition: transform .35s ease; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .snow { display: none; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
