:root {
  --paper: #ece8ff;
  --paper-2: #ddd6ff;
  --ink: #2a1745;
  --ink-soft: #6b5a86;
  --seal: #e8432e;
  --seal-dark: #b8301f;
  --sun: #ffc93c;
  --mint: #2fbf8f;
  --card: #fff;
  --line: 2px solid var(--ink);
  --pop: 5px 5px 0 var(--ink);
  --font: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  font: 400 17px/1.5 var(--font);
  min-height: 100vh;
  /* faint envelope-paper grid */
  background-image: radial-gradient(var(--paper-2) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
main { max-width: 780px; margin: 0 auto; padding: 8px 20px 96px; outline: none; }

h1, h2, h3 { line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.02em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; font-variation-settings: 'opsz' 96; }
h2 { font-size: 1.6rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 62ch; }
a { color: var(--seal-dark); font-weight: 600; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }

.top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 780px; margin: 0 auto; padding: 20px; }
.logo { font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; color: var(--ink); text-decoration: none; line-height: 1; flex: none; }
.logo span { color: var(--seal); }
nav { display: flex; gap: 6px; align-items: center; justify-content: flex-end; min-width: 0; }
.nav-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav-controls { display: flex; gap: 8px; align-items: center; flex: none; }
nav a, nav button { font: 600 .95rem var(--font); color: var(--ink); text-decoration: none; background: none; border: 0; padding: 8px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
nav a:hover, nav button:hover { background: var(--paper-2); }
nav .lang { border: 2px solid var(--ink); padding: 0 11px; height: 36px; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; letter-spacing: .04em; }
.nav-toggle { display: none; border: 2px solid var(--ink); width: 40px; height: 36px; padding: 0; align-items: center; justify-content: center; }
.nav-toggle .ico-close { display: none; }

@media (max-width: 719px) {
  .top { padding: 16px 20px; gap: 12px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% - 4px);
    left: 20px;
    right: 20px;
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px;
    background: var(--card);
    border: var(--line);
    border-radius: 20px;
    box-shadow: var(--pop);
  }
  nav.open .nav-links { display: flex; }
  .nav-links a, .nav-links button { width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; font-size: 1rem; white-space: normal; }
  .nav-links a:hover, .nav-links button:hover { background: var(--paper); }
  nav.open .nav-toggle { background: var(--sun); }
  nav.open .nav-toggle .ico-menu { display: none; }
  nav.open .nav-toggle .ico-close { display: block; }
}

/* ---------- controls ---------- */
.btn {
  font: 700 1rem var(--font);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--seal); color: #fff; }
.btn.sun { background: var(--sun); }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; text-decoration: underline; padding: 8px 10px; }
.btn.ghost:hover { transform: none; background: var(--paper-2); }
.btn.danger { color: var(--seal-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.tiny { padding: 6px 12px; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.tiny.ghost { box-shadow: none; }

:focus-visible { outline: 3px solid var(--seal); outline-offset: 3px; }
main:focus-visible { outline: none; }

label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
input, select, textarea {
  font: 400 1rem var(--font); color: var(--ink);
  width: 100%; padding: 11px 14px; border: var(--line); border-radius: 14px; background: #fff;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 4px var(--sun); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--seal); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .grow { flex: 1 1 180px; }
.stack > * + * { margin-top: 14px; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--pop); margin: 22px 0; }
.card.flat { box-shadow: none; }
.card.sunny { background: #fff4cc; }
.card.minty { background: #dcf7ec; }
.card.alert { background: #ffe1dc; }

.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 2px solid var(--ink); background: #fff; white-space: nowrap; }
.pill.open { background: var(--paper-2); }
.pill.drafted { background: var(--sun); }
.pill.published { background: var(--mint); color: #fff; border-color: var(--ink); }
.pill.alert { background: #ffe1dc; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 2px dashed var(--paper-2); flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list .who { flex: 1 1 200px; min-width: 0; }
.list .who b { display: block; }
.list .who span { color: var(--ink-soft); font-size: .9rem; overflow-wrap: anywhere; }
.list a.rowlink { color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; width: 100%; }

.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: var(--line); }

.empty { text-align: center; padding: 28px 10px; color: var(--ink-soft); }

/* ---------- home ---------- */
.hero { display: grid; gap: 28px; align-items: center; padding: 20px 0 10px; }
@media (min-width: 720px) { .hero { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { margin-bottom: .3em; }
.hero .lede { font-size: 1.2rem; color: var(--ink-soft); }
.hero h1 .eyebrow { display: block; font-size: .9rem; font-weight: 700; letter-spacing: .02em; color: var(--seal-dark); margin-bottom: .7em; font-variation-settings: normal; }
.hero .aka { margin: 0; font-weight: 600; }
.hero .aka a { text-underline-offset: 3px; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.ring-demo { width: 100%; max-width: 340px; justify-self: center; }
.ring { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.ring-demo .loop { stroke-dasharray: 6 8; animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -14; } }

.steps { list-style: none; padding: 0; display: grid; gap: 16px; counter-reset: s; margin-top: 36px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: s; background: #fff; border: var(--line); border-radius: 20px; padding: 18px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); border: var(--line); font-weight: 800; margin-bottom: 10px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* ---------- code input ---------- */
.code-input { font-size: 2rem; letter-spacing: .5em; text-align: center; font-weight: 800; padding: 14px; }

/* ---------- group page ---------- */
.group-head { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-top: 10px; }
.facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 0; }
.facts span { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 4px 10px; font-size: .9rem; }
details summary { cursor: pointer; font-weight: 700; }
.ex-tag { display: inline-flex; gap: 8px; align-items: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 6px 4px 14px; margin: 4px 6px 4px 0; font-weight: 600; font-size: .92rem; }
.ex-tag button { border: 0; background: var(--ink); color: #fff; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-weight: 800; line-height: 1; }

/* draw view: blank dots before peeking, name chains after */
.strips, #chains { margin: 4px 0 16px; }
.loop { margin-top: 14px; }
.loophead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 800; font-size: .92rem; }
.loopdot { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid var(--ink); }
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 10px; border: 2px dashed var(--ink-soft); border-radius: 14px; background: var(--paper); }
.strip i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.strip b { color: var(--ink-soft); font-size: .8rem; margin-left: 4px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 2px; }
.mp { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 700; font-size: .85rem; white-space: nowrap; transition: opacity .15s, background .15s; }
.mp .avatar { width: 24px; height: 24px; font-size: .62rem; border-width: 1.5px; }
.mp.dim { opacity: .25; }
.mp.hit { background: var(--sun); box-shadow: 2px 2px 0 var(--ink); }
.arr { color: var(--ink-soft); font-weight: 800; padding: 0 2px; }
.back { color: var(--ink-soft); font-size: .8rem; font-weight: 700; margin-left: 4px; }
.answer { margin-top: 8px; padding: 8px 12px; background: var(--paper); border-radius: 12px; font-size: .92rem; }
.answer mark { background: var(--sun); border-radius: 4px; padding: 0 4px; font-weight: 800; color: var(--ink); }

/* ---------- envelope (the one big moment) ---------- */
.envelope-stage { display: grid; place-items: center; padding: 150px 0 10px; perspective: 900px; }
.envelope {
  position: relative; width: min(420px, 92vw); aspect-ratio: 1.55;
  background: #ffd9a8; border: var(--line); border-radius: 14px; box-shadow: var(--pop);
  cursor: pointer; font: inherit; color: var(--ink); padding: 0;
}
.envelope::after { /* pocket: solid front with a V notch the flap closes over */
  content: ''; position: absolute; inset: 0; border-radius: 12px; z-index: 3; pointer-events: none;
  background: linear-gradient(200deg, #ffd59a, #ffc47a);
  clip-path: polygon(0 0, 50% 62%, 100% 0, 100% 100%, 0 100%);
}
.flap {
  position: absolute; inset: 0 0 auto 0; height: 62%; z-index: 4; transform-origin: top;
  clip-path: polygon(0 0, 100% 0, 50% 100%); background: #ffb866;
  transition: transform .6s cubic-bezier(.5,-0.3,.4,1.3), z-index 0s .3s;
  border-radius: 12px 12px 0 0;
}
.seal {
  position: absolute; left: 50%; top: 62%; z-index: 5; width: 76px; height: 76px; margin: -38px 0 0 -38px;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff6b55, var(--seal) 55%, var(--seal-dark));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 2rem;
  box-shadow: 0 3px 0 var(--seal-dark), inset 0 0 0 6px rgba(255,255,255,.18);
  transition: transform .45s ease-in, opacity .45s ease-in;
  border: 0;
}
.envelope:hover .seal { transform: rotate(-8deg) scale(1.05); }
.letter {
  position: absolute; left: 6%; right: 6%; top: 8%; bottom: 8%; z-index: 2;
  background: #fff; border: var(--line); border-radius: 10px; padding: 16px;
  display: grid; place-items: center; text-align: center;
  transition: transform .7s cubic-bezier(.3,1.4,.5,1) .45s;
  visibility: hidden;
}
.letter .to { font-size: .9rem; color: var(--ink-soft); }
.letter .name { font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.envelope.open { cursor: default; }
.envelope.open .seal { transform: translateY(40px) rotate(40deg) scale(.6); opacity: 0; }
.envelope.open .flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .letter { transform: translateY(-58%); visibility: visible; }
.envelope-hint { margin-top: 20px; font-weight: 600; color: var(--ink-soft); }
.after-open { margin-top: 80px; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
  .confetti { display: none; }
}

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 40px)); visibility: hidden; transition: transform .25s, visibility .25s; z-index: 60;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.error { background: var(--seal-dark); }

/* ---------- outbox (dev) ---------- */
.mail iframe { width: 100%; height: 420px; border: var(--line); border-radius: 14px; background: #fff; }

/* ---------- gift lists ---------- */
.gifts { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.gift { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: start; background: #fff; border: var(--line); border-radius: 16px; padding: 12px; }
.gift-img { width: 76px; height: 76px; border-radius: 12px; background: var(--paper); display: grid; place-items: center; overflow: hidden; font-size: 2rem; border: 2px solid var(--paper-2); }
.gift-img img { width: 100%; height: 100%; object-fit: cover; }
.gift-img2 { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 2px solid var(--paper-2); margin: 6px 0; display: block; }
.gift-body { min-width: 0; }
.gift-body b { font-size: 1.05rem; overflow-wrap: anywhere; }
.gift-body p { margin: 4px 0; font-size: .92rem; color: var(--ink-soft); white-space: pre-wrap; }
.gift-body a { font-size: .88rem; }
.price { display: inline-block; background: var(--sun); border: 2px solid var(--ink); border-radius: 999px; padding: 0 10px; font-weight: 700; font-size: .88rem; margin-left: 4px; white-space: nowrap; }
.gift-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.gift.bought { background: #eef9f3; }
.gift.bought .gift-body b { text-decoration: line-through; text-decoration-thickness: 2px; }
@media (min-width: 620px) {
  .gift { grid-template-columns: 76px 1fr auto; }
  .gift-actions { grid-column: auto; flex-direction: column; align-items: stretch; }
}

.gift-editor { background: var(--paper); border: 2px dashed var(--ink-soft); border-radius: 18px; padding: 16px; margin-bottom: 8px; }
.gift-editor h3 { margin: 0; }
.label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 14px; border: var(--line); overflow: hidden; background: #fff; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-weight: 800; cursor: pointer; }
.thumb.add { cursor: pointer; font-size: 2rem; font-weight: 800; border-style: dashed; margin: 0; }
.thumb.add:focus-within { outline: 3px solid var(--seal); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.warn { color: var(--seal-dark); font-weight: 600; }
.search-row { margin-bottom: 12px; }
.search-row select { width: auto; }
#jgifts summary { list-style: none; }
#jgifts summary::-webkit-details-marker { display: none; }
#jgifts summary h2::after { content: ' ▾'; font-size: 1rem; }
#jgifts[open] summary h2::after { content: ' ▴'; }
.jperson + .jperson { border-top: 2px dashed var(--paper-2); padding-top: 14px; margin-top: 4px; }

/* ---------- footer ---------- */
.foot { max-width: 780px; margin: 0 auto; padding: 20px 20px 44px; border-top: 2px dashed var(--paper-2); font-size: .88rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.foot-links { display: flex; gap: 14px; flex-wrap: wrap; }
.foot a { color: var(--ink); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; }

/* ---------- gift ideas & affiliates ---------- */
.tier-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.tier-pills button { font: 700 .85rem var(--font); padding: 6px 12px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.tier-pills button.active { background: var(--sun); box-shadow: 2px 2px 0 var(--ink); }
.ideas { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
@media (min-width: 620px) { .ideas { grid-template-columns: repeat(2, 1fr); } }
.idea { background: #fff; border: var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.idea-head { display: flex; gap: 10px; align-items: flex-start; }
.idea-emoji { font-size: 1.5rem; line-height: 1; flex: none; }
.idea-head b { display: block; font-size: .98rem; line-height: 1.25; }
.idea-head span { display: block; font-size: .85rem; color: var(--ink-soft); margin-top: 2px; }
.idea-links { display: flex; gap: 8px; flex-wrap: wrap; }
.idea.featured { background: #fff4cc; grid-column: 1 / -1; }
.disclosure { font-size: .8rem; color: var(--ink-soft); margin: 12px 0 0; }

/* ---------- corporate / empresas ---------- */
.pill.pro { background: var(--ink); color: var(--sun); }
.brand-badge { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 800; font-size: .92rem; margin-bottom: 10px; box-shadow: 2px 2px 0 var(--ink); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
.plans { display: grid; gap: 18px; margin: 22px 0; }
@media (min-width: 680px) { .plans { grid-template-columns: repeat(2, 1fr); } }
.plan-card { margin: 0; display: flex; flex-direction: column; justify-content: space-between; }
.plan-price { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 4px; }
.plan-price small { font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.check-list { list-style: none; padding: 0; margin: 14px 0 18px; }
.check-list li { padding: 5px 0; font-size: .95rem; }
.check-list li::before { content: '✓ '; color: var(--mint); font-weight: 800; }
.faq { margin-top: 28px; }
.faq details { background: #fff; border: var(--line); border-radius: 16px; padding: 14px 18px; margin: 10px 0; }
.faq details p { margin: 10px 0 0; color: var(--ink-soft); font-size: .95rem; }
.pix-box { background: #fff; border: 2px dashed var(--ink); border-radius: 14px; padding: 12px 14px; margin: 10px 0; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pix-box code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; word-break: break-all; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 54px; height: 46px; padding: 4px; cursor: pointer; flex: none; }
.dept-pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--paper); border: 1.5px solid var(--ink); margin-left: 6px; vertical-align: middle; }
.csv-box { background: var(--paper); border: 2px dashed var(--ink-soft); border-radius: 16px; padding: 14px; margin: 12px 0; }
