@font-face { font-family: "Caprasimo"; src: url("/fonts/caprasimo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --pino: #12301f;
  --pino-2: #1b4430;
  --kraft: #d8b47e;
  --kraft-claro: #ecd5a8;
  --tinta: #3a2614;
  --tinta-suave: #6b5236;
  --arandano: #a8202c;
  --arandano-osc: #861822;
  --oro: #e9b949;
  --nieve: #fbf6ec;
  --display: "Caprasimo", Georgia, serif;
  --body: "Figtree", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--tinta);
  background-color: var(--pino);
  /* Papel de regalo: pinitos y estrellas */
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(233, 185, 73, 0.16), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%231b4430'%3E%3Cpath d='M30 12l10 16h-6l9 14h-7l8 12H16l8-12h-7l9-14h-6z'/%3E%3Crect x='28' y='54' width='4' height='6'/%3E%3Cpath d='M90 72l10 16h-6l9 14h-7l8 12H76l8-12h-7l9-14h-6z'/%3E%3Crect x='88' y='114' width='4' height='6'/%3E%3C/g%3E%3Cg fill='%23e9b949' opacity='.35'%3E%3Cpath d='M92 22l2.4 5 5.6.8-4 3.9 1 5.5-5-2.6-5 2.6 1-5.5-4-3.9 5.6-.8z'/%3E%3Cpath d='M28 82l2.4 5 5.6.8-4 3.9 1 5.5-5-2.6-5 2.6 1-5.5-4-3.9 5.6-.8z'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- Decoración ---------- */
.garland { position: fixed; top: -2px; left: 0; right: 0; height: 60px; z-index: 5; pointer-events: none; }
.garland svg { width: 100%; height: 100%; display: block; }
.bulb {
  position: absolute; top: 17px; width: 12px; height: 18px; margin-left: -6px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c);
  box-shadow: 0 0 10px 2px var(--c);
  animation: twinkle 2.4s ease-in-out infinite;
}
.bulb::before { content: ""; position: absolute; top: -5px; left: 3px; width: 6px; height: 6px; border-radius: 2px; background: #0b1f14; }
@keyframes twinkle {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px 3px var(--c); }
  50% { opacity: 0.45; box-shadow: 0 0 2px 0 var(--c); }
}
.snow, .confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.snow { z-index: 0; }
.confetti { z-index: 50; }

/* ---------- Página principal ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 72px 20px 64px;
}

.hero { text-align: center; color: var(--nieve); margin-bottom: 48px; position: relative; }
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  line-height: 0.98;
  margin: 0;
  letter-spacing: -0.01em;
  text-shadow: 0 4px 0 var(--arandano-osc), 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: rise 0.7s cubic-bezier(.2, .8, .2, 1) both;
}
.hero p { margin: 16px auto 0; max-width: 34ch; color: #cfe0d3; animation: rise 0.7s 0.12s cubic-bezier(.2, .8, .2, 1) both; }
.sparkle { position: absolute; width: 22px; height: 22px; color: var(--oro); animation: sparkle 2.8s ease-in-out infinite; }
.sparkle.s1 { top: -14px; left: 6%; }
.sparkle.s2 { top: 34%; right: 2%; width: 16px; height: 16px; animation-delay: 0.9s; }
.sparkle.s3 { bottom: 30%; left: -2%; width: 14px; height: 14px; animation-delay: 1.7s; }
@keyframes sparkle { 0%, 100% { transform: scale(0.4) rotate(0); opacity: 0.2; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.date-ribbon {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px; padding: 8px 18px;
  background: var(--arandano); color: var(--nieve);
  font-weight: 600; font-size: 0.95rem;
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%, 12px 50%);
  padding-left: 26px; padding-right: 26px;
  animation: rise 0.7s 0.24s cubic-bezier(.2, .8, .2, 1) both;
}

/* ---------- La etiqueta de regalo ---------- */
.tag-wrap {
  position: relative;
  transform-origin: 50% 0;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.4));
  animation: swing 1.8s 0.2s cubic-bezier(.3, .6, .3, 1) both;
  --rest: -1.5deg;
}
@keyframes swing {
  0% { transform: translateY(-40px) rotate(14deg); opacity: 0; }
  18% { opacity: 1; }
  35% { transform: rotate(-9deg); }
  55% { transform: rotate(5deg); }
  75% { transform: rotate(-3.5deg); }
  100% { transform: rotate(var(--rest)); }
}
.twine { display: block; width: 120px; height: 46px; margin: -30px auto -33px; position: relative; z-index: 2; }
.tag {
  position: relative;
  background: var(--kraft-claro);
  background-image: radial-gradient(rgba(58, 38, 20, 0.06) 1px, transparent 1.2px);
  background-size: 6px 6px;
  border-radius: 14px 14px 22px 22px;
  padding: 56px 28px 22px;
  clip-path: polygon(16% 0, 84% 0, 100% 9%, 100% 100%, 0 100%, 0 9%);
}
.tag::before {
  content: "";
  position: absolute; top: 18px; left: 50%;
  width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%;
  background: var(--pino);
  box-shadow: 0 0 0 5px var(--kraft);
}
.tag::after {
  /* borde cosido */
  content: ""; position: absolute; inset: 10px; pointer-events: none;
  border: 2px dashed rgba(168, 32, 44, 0.22); border-radius: 10px 10px 16px 16px;
  clip-path: polygon(15% 0, 85% 0, 100% 8%, 100% 100%, 0 100%, 0 8%);
}
.view { animation: viewIn 0.35s cubic-bezier(.2, .8, .2, 1) both; position: relative; z-index: 1; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tag h2 { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; margin: 0 0 6px; color: var(--pino); }
.tag .lead { margin: 0 0 22px; }

label { display: block; font-weight: 600; margin: 0 0 4px; }
.field { margin-bottom: 18px; }
.hint { font-size: 0.9rem; color: var(--tinta-suave); margin: 4px 0 0; }

input[type="email"], input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%;
  font: inherit;
  color: var(--tinta);
  background: transparent;
  border: 0;
  border-bottom: 2px dashed rgba(58, 38, 20, 0.45);
  padding: 8px 4px;
  border-radius: 6px 6px 0 0;
  transition: background 0.2s, border-color 0.2s;
}
textarea { border: 2px dashed rgba(58, 38, 20, 0.45); border-radius: 10px; padding: 10px; min-height: 140px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--arandano); border-bottom-style: solid; background: rgba(255, 255, 255, 0.4); }

.wish { display: grid; grid-template-columns: 34px 1fr; align-items: end; gap: 6px; margin-bottom: 14px; }
.wish .bow { width: 30px; height: 30px; margin-bottom: 6px; color: rgba(58, 38, 20, 0.25); transition: color 0.25s; }
.wish.filled .bow { color: var(--arandano); animation: pop 0.45s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes pop { 0% { transform: scale(0.6) rotate(-20deg); } 100% { transform: none; } }

button {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  background: var(--arandano);
  color: var(--nieve);
  box-shadow: 0 4px 0 var(--arandano-osc);
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
button:hover:not(:disabled) { background: #b9242f; transform: translateY(-2px); box-shadow: 0 6px 0 var(--arandano-osc); }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--arandano-osc); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--tinta); box-shadow: inset 0 0 0 2px rgba(58, 38, 20, 0.35); }
button.secondary:hover:not(:disabled) { background: rgba(58, 38, 20, 0.07); box-shadow: inset 0 0 0 2px rgba(58, 38, 20, 0.55); }
button.link { background: none; box-shadow: none; padding: 4px 0; color: var(--tinta); text-decoration: underline; font-weight: 500; }
button.link:hover:not(:disabled) { background: none; box-shadow: none; color: var(--arandano); }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 3px; }

.actions { display: flex; gap: 12px 18px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.error { color: var(--arandano); font-weight: 600; margin: 12px 0 0; min-height: 1.5em; }

/* ---------- Sello ---------- */
.stamp {
  display: inline-block;
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--arandano);
  border: 4px double var(--arandano);
  border-radius: 12px;
  padding: 6px 18px;
  transform: rotate(-8deg);
  margin: 6px 0 18px;
  opacity: 0.9;
}
.stamp.thump { animation: thump 0.45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes thump { from { transform: rotate(-20deg) scale(2.2); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 0.9; } }
.summary { list-style: none; padding: 0; margin: 0 0 18px; }
.summary li { padding: 9px 0 9px 30px; border-bottom: 1px dashed rgba(58, 38, 20, 0.3); position: relative; }
.summary li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 18px; height: 18px; background: var(--arandano); mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 9h18v4H3zM5 13h14v8H5zM11 9h2v12h-2zM12 9C9 3 4 5 7 8zM12 9c3-6 8-4 5-1z'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- Escritorio: página principal en dos columnas ---------- */
@media (min-width: 920px) {
  .page.home {
    max-width: 1100px;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 72px;
    align-items: center;
    padding: 90px 40px 60px;
  }
  .home .hero { text-align: left; margin: 0; }
  .home .hero h1 { font-size: 5.2rem; }
  .home .hero p { margin-left: 0; font-size: 1.15rem; max-width: 30ch; }
}

@media (max-width: 480px) {
  .page { padding-top: 64px; }
  .tag { padding: 52px 20px 18px; }
  .tag-wrap { --rest: 0deg; }
}

[hidden] { display: none !important; }

/* ---------- Panel de administración ---------- */
.admin .page { max-width: 1180px; padding: 76px 24px 60px; }
.admin .hero { text-align: left; margin-bottom: 28px; display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.admin .hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.admin .hero p { margin-left: 0; max-width: 50ch; }
.admin-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) {
  .admin-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
  .admin-side { position: sticky; top: 76px; }
}
.panel {
  background: var(--kraft-claro);
  background-image: radial-gradient(rgba(58, 38, 20, 0.05) 1px, transparent 1.2px);
  background-size: 6px 6px;
  border-radius: 18px;
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
  animation: rise 0.6s cubic-bezier(.2, .8, .2, 1) both;
}
.admin-side .panel:nth-child(1) { animation-delay: 0.08s; }
.admin-side .panel:nth-child(2) { animation-delay: 0.16s; }
.admin-side .panel:nth-child(3) { animation-delay: 0.24s; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 1.45rem; margin: 0 0 12px; color: var(--pino); }
.panel > :last-child { margin-bottom: 0; }
#login.panel { max-width: 440px; }

.stats { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; }
.ring { width: 112px; height: 112px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: rgba(58, 38, 20, 0.14); }
.ring .fill { stroke: var(--pino-2); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1), stroke 0.3s; }
.ring.complete .fill { stroke: var(--arandano); }
.ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 1.9rem; color: var(--pino); }
.stats p { margin: 0; font-size: 1.1rem; }
.stats .big { font-family: var(--display); font-size: 1.5rem; color: var(--pino); line-height: 1.15; }

#draw.ready { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 var(--arandano-osc), 0 0 0 0 rgba(233, 185, 73, 0.7); } 50% { box-shadow: 0 4px 0 var(--arandano-osc), 0 0 0 10px rgba(233, 185, 73, 0); } }

.banner { display: flex; gap: 14px; align-items: center; background: var(--pino-2); color: var(--nieve); border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.banner svg { width: 34px; height: 34px; flex: none; color: var(--oro); }
.banner p { margin: 0; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input { flex: 1 1 220px; }
.chips { display: inline-flex; background: rgba(58, 38, 20, 0.08); border-radius: 999px; padding: 4px; }
.chips button { background: none; box-shadow: none; color: var(--tinta); padding: 7px 14px; font-weight: 600; font-size: 0.92rem; }
.chips button:hover:not(:disabled) { background: rgba(58, 38, 20, 0.08); box-shadow: none; transform: none; }
.chips button[aria-pressed="true"] { background: var(--pino-2); color: var(--nieve); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { text-align: left; font-weight: 700; padding: 8px 6px; border-bottom: 2px solid rgba(58, 38, 20, 0.3); }
td { padding: 10px 6px; border-bottom: 1px dashed rgba(58, 38, 20, 0.25); vertical-align: middle; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.35); }
td.email { color: var(--tinta-suave); word-break: break-all; }
td.when { color: var(--tinta-suave); font-size: 0.88rem; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--pino-2); color: var(--nieve); }
.pill.no { background: rgba(168, 32, 44, 0.14); color: var(--arandano); }
.pill.no::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: twinkle-dot 1.6s infinite; }
@keyframes twinkle-dot { 50% { opacity: 0.25; } }
.remove { background: none; box-shadow: none; color: var(--arandano); padding: 4px 8px; font-weight: 600; }
.remove:hover:not(:disabled) { background: rgba(168, 32, 44, 0.1); box-shadow: none; transform: none; }
.note { background: rgba(233, 185, 73, 0.32); border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
details summary { cursor: pointer; font-family: var(--display); font-size: 1.2rem; color: var(--pino); }
details[open] summary { margin-bottom: 10px; }
.msg { margin: 12px 0 0; font-weight: 600; }
.msg:empty { display: none; }
.msg.ok { color: var(--pino-2); }
.msg.bad { color: var(--arandano); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Ajustes de pantallas angostas */
.admin-grid { grid-template-columns: minmax(0, 1fr); }
.admin-main, .admin-side, .stats > div { min-width: 0; }
.ring .num { font-size: 1.6rem; }
@media (max-width: 600px) {
  .admin .page { padding: 70px 14px 90px; }
  .panel { padding: 20px 18px; }
  .ring { width: 92px; height: 92px; }
  .ring .num { font-size: 1.3rem; }
  th:nth-child(4), td.when { display: none; }
}
