:root {
  --bg: #0c2019;
  --bg2: #123226;
  --card: #163a2d;
  --card2: #1b4535;
  --line: rgba(246, 239, 227, 0.12);
  --text: #f6efe3;
  --muted: #b9c9bd;
  --red: #d9453b;
  --red2: #b9332b;
  --gold: #e8c170;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, #1c5340 0%, transparent 60%), linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  padding-bottom: 92px;
}
h1, h2, h3, .serif { font-family: "Fraunces", Georgia, "Times New Roman", serif; letter-spacing: -0.01em; }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 0 16px; }
a { color: var(--gold); }

/* cabecera */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 8px; gap: 12px; }
.brand { font-family: "Fraunces", Georgia, serif; font-size: 1.15rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand-text { display: grid; line-height: 1.15; text-align: left; }
.brand-text small { font: 500 .74rem system-ui, -apple-system, sans-serif; color: var(--gold); letter-spacing: .02em; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 30px 0 6px; opacity: .8; }
.count { font-size: 0.85rem; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 5px 12px; border-radius: 99px; white-space: nowrap; }
.count b { color: var(--gold); font-weight: 700; }

/* tarjeta principal */
.hero {
  margin-top: 10px;
  text-align: center;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 26px 20px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
  position: relative;
  overflow: hidden;
}
.hero .hello { color: var(--muted); margin: 0 0 4px; }
.hero h1 { margin: 0 0 14px; font-size: 1.7rem; line-height: 1.15; font-weight: 600; }
.gift { all: unset; cursor: pointer; display: block; margin: 0 auto; width: 170px; }
.gift svg { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 10px 14px rgba(0,0,0,.35)); }
.gift .lid { transform-origin: 30px 60px; transition: transform .7s cubic-bezier(.3,1.6,.5,1), opacity .5s .3s; }
.gift:not(.open) { animation: wiggle 2.6s ease-in-out infinite; }
.gift.open .lid { transform: translate(-6px, -52px) rotate(-22deg); opacity: 0; }
.gift:focus-visible { outline: 3px solid var(--gold); outline-offset: 6px; border-radius: 12px; }
.tap { margin: 10px 0 0; color: var(--gold); font-weight: 600; font-size: .95rem; }
@keyframes wiggle { 0%, 82%, 100% { transform: rotate(0) } 86% { transform: rotate(-3deg) } 90% { transform: rotate(3deg) } 94% { transform: rotate(-2deg) } }

.reveal-label { color: var(--muted); margin: 0; font-size: .95rem; }
.reveal-name { font-family: "Fraunces", Georgia, serif; font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1.05; margin: 4px 0 12px; color: var(--gold); font-weight: 700; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { font-size: .85rem; padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.07); border: 1px solid var(--line); color: var(--text); }
.pop { animation: pop .7s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: 40%; left: 50%; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: burst 1.6s ease-out forwards; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0,0) rotate(0) }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) }
}

/* secciones */
h2 { font-size: 1.35rem; margin: 26px 2px 4px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 2px 14px; font-size: .95rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 22px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); margin-bottom: 14px; }

/* ideas */
.items { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.item.done { opacity: .6; }
.item.done .t { text-decoration: line-through; }
.thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--bg); display: grid; place-items: center; color: var(--gold); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb svg { width: 28px; height: 28px; opacity: .8; }
.item .t { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.item .t a { color: var(--text); text-decoration: none; }
.item .t a:hover { text-decoration: underline; }
.meta { font-size: .82rem; color: var(--muted); }
.meta .price { color: var(--gold); font-weight: 600; }
.note { font-size: .88rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.iconbtn { all: unset; cursor: pointer; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); border: 1px solid var(--line); }
.iconbtn:hover, .iconbtn:focus-visible { color: var(--text); background: rgba(255,255,255,.08); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn[aria-pressed="true"] { background: var(--gold); color: #3b2a05; border-color: var(--gold); }
.iconbtn.danger:hover { color: #ff9b94; }

/* formularios */
form { display: grid; gap: 10px; }
label { font-size: .85rem; color: var(--muted); display: grid; gap: 4px; }
input, textarea {
  font: inherit; color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; width: 100%; min-height: 46px;
}
textarea { resize: vertical; min-height: 78px; }
input::placeholder, textarea::placeholder { color: rgba(185,201,189,.55); }
input:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 14px; padding: 12px 18px; min-height: 48px;
  color: #fff; background: linear-gradient(180deg, var(--red), var(--red2)); box-shadow: 0 6px 16px rgba(217,69,59,.28);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; box-shadow: none; border: 1px solid var(--line); color: var(--text); }
.btn.small { padding: 8px 14px; min-height: 40px; font-size: .9rem; }

/* preguntas */
.thread { display: grid; gap: 8px; margin-bottom: 12px; }
.bubble { padding: 10px 14px; border-radius: 16px; max-width: 88%; overflow-wrap: anywhere; font-size: .95rem; }
.bubble.q { background: var(--card2); border: 1px solid var(--line); justify-self: end; border-bottom-right-radius: 4px; }
.bubble.a { background: rgba(232,193,112,.16); border: 1px solid rgba(232,193,112,.3); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.wait { background: transparent; border: 1px dashed var(--line); color: var(--muted); justify-self: start; font-style: italic; }
.who { font-size: .72rem; color: var(--muted); display: block; margin-bottom: 1px; }
.qcard .asked { font-weight: 600; margin: 0 0 10px; overflow-wrap: anywhere; }

/* nav inferior */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(8,22,17,.92) 35%); }
.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: rgba(20,52,40,.96); border: 1px solid var(--line); border-radius: 20px; padding: 6px; backdrop-filter: blur(8px); }
.tab { all: unset; cursor: pointer; text-align: center; padding: 8px 4px; border-radius: 14px; font-size: .78rem; color: var(--muted); display: grid; justify-items: center; gap: 2px; position: relative; min-height: 48px; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] { background: var(--red); color: #fff; }
.tab:focus-visible { outline: 2px solid var(--gold); }
.tab .badge { position: absolute; top: 2px; right: calc(50% - 26px); background: var(--gold); color: #3b2a05; font-weight: 700; font-size: .7rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #2a0f0d; color: #ffd6d2; border: 1px solid #7c2b25; padding: 10px 16px; border-radius: 14px; z-index: 20; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.ok { background: #10301f; color: #cdeed8; border-color: #2f7a4d; }
.center { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 20px; }
.center h1 { font-size: 1.6rem; margin: 10px 0; }
.spin { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: sp 0.9s linear infinite; margin: 0 auto; }
@keyframes sp { to { transform: rotate(360deg) } }
.fade { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* admin */
.linkrow { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.linkrow:first-child { border-top: 0; }
.linkrow .nm { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.linkrow .nm span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.linkrow code { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.warn { background: rgba(232,193,112,.1); border: 1px solid rgba(232,193,112,.3); border-radius: 14px; padding: 12px 14px; font-size: .9rem; margin-bottom: 14px; }

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