:root {
  --blue: #4a89f3;
  --blue-dark: #2f6fdc;
  --blue-soft: #e8f0fe;
  --lav: #dfe5fa;
  --lav-2: #d3dbf7;
  --gold: #f7c64a;
  --coral: #ee6b5c;
  --salmon: #f39a86;
  --green: #22a06b;
  --green-soft: #e3f5ec;
  --red: #e5483e;
  --red-soft: #fdecea;
  --ink: #23262f;
  --muted: #8b90a0;
  --row: #f2f3f7;
  --line: #eceef3;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(60, 80, 160, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100dvh;
  background-color: var(--lav);
  /* copos de nieve */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='260' viewBox='0 0 220 260'%3E%3Cg stroke='%23fff' stroke-width='1.6' stroke-linecap='round' fill='none' opacity='.9'%3E%3Cg transform='translate(40 50)'%3E%3Cpath d='M0-14V14M-12-7 12 7M-12 7 12-7M-3-11 0-8 3-11M-3 11 0 8 3 11'/%3E%3C/g%3E%3Cg transform='translate(170 120) scale(.7)'%3E%3Cpath d='M0-14V14M-12-7 12 7M-12 7 12-7M-3-11 0-8 3-11M-3 11 0 8 3 11'/%3E%3C/g%3E%3Cg transform='translate(80 210) scale(1.1)'%3E%3Cpath d='M0-14V14M-12-7 12 7M-12 7 12-7M-3-11 0-8 3-11M-3 11 0 8 3 11'/%3E%3C/g%3E%3C/g%3E%3Cg fill='%23fff' opacity='.8'%3E%3Ccircle cx='130' cy='30' r='2'/%3E%3Ccircle cx='200' cy='220' r='2.5'/%3E%3Ccircle cx='20' cy='150' r='1.8'/%3E%3Ccircle cx='120' cy='160' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- cabecera ---------- */
.top { padding: calc(12px + var(--safe-top)) 16px 0; }
.top-bar { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.top-bar .title { font-weight: 700; font-size: 17px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4b5170; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; display: grid; place-items: center;
  background: rgba(255,255,255,.75); color: var(--blue); cursor: pointer; flex: none; box-shadow: 0 4px 12px rgba(60,80,160,.10);
}
.icon-btn svg { width: 22px; height: 22px; }

.banner { display: block; width: 100%; max-width: 360px; height: auto; margin: 6px auto -18px; position: relative; z-index: 1; }
.hero-illus { display: block; width: 78%; max-width: 300px; margin: 4px auto -26px; position: relative; z-index: 1; }

.intro {
  position: relative; z-index: 2; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; margin: 0 0 14px;
}
.intro h1 { font-size: 24px; line-height: 1.15; margin: 0 0 4px; font-weight: 800; }
.intro p.lead { margin: 0; color: #4b5170; font-style: italic; font-size: 16.5px; }
.intro p.lead b { font-style: italic; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px;
  background: var(--row); font-weight: 600; font-size: 14px; color: #4b5170;
}

.sheet { flex: 1; padding: 0 16px calc(28px + var(--safe-bottom)); }
.has-nav .sheet { padding-bottom: calc(var(--nav-h) + 28px + var(--safe-bottom)); }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; position: relative; z-index: 2;
}
.card h2 { font-size: 19px; margin: 0 0 4px; font-weight: 700; }
.card .sub { color: var(--muted); margin: 0 0 14px; font-size: 15px; }
.section-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: #6a7193; margin: 20px 4px 10px; }

/* ---------- botones ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 0; border-radius: 10px; padding: 13px 18px; font-weight: 700; font-size: 16.5px;
  cursor: pointer; text-decoration: none; transition: transform .08s ease, opacity .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(74,137,243,.35); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: #fff; color: var(--blue); border: 2px solid var(--blue); padding: 11px 16px; }
.btn-ghost { background: transparent; color: var(--blue); padding: 10px; font-size: 15.5px; }
.btn-green { background: #25d366; color: #fff; }
.btn-sm { padding: 9px 14px; font-size: 14px; width: auto; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn + .btn { margin-top: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row > .btn + .btn { margin-top: 0; }

/* ---------- formularios ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px 2px; color: #4b5170; }
.input {
  width: 100%; border: 2px solid transparent; background: var(--row); border-radius: 10px;
  padding: 12px 13px; font-size: 16px; outline: none; transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--blue); background: #fff; }
textarea.input { resize: none; min-height: 80px; }
.input-wrap { position: relative; }
.input-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }

.people { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.person-row { display: flex; align-items: center; gap: 8px; }
.person-row .input { flex: 1; }
.remove-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--row); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.remove-btn svg { width: 16px; height: 16px; }

.counter { text-align: right; font-size: 12.5px; color: var(--muted); margin: 4px 4px 10px; }
.counter.over { color: var(--red); font-weight: 700; }

/* ---------- avatares y listas ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px; flex: none; text-transform: uppercase;
}
.avatar.lg { width: 84px; height: 84px; border-radius: 24px; font-size: 38px; margin: 0 auto; box-shadow: 0 8px 20px rgba(60,80,160,.18); }

.list { display: flex; flex-direction: column; gap: 10px; }
.pick {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--row); border: 0; border-radius: 12px; padding: 10px 12px;
  font-weight: 700; font-size: 17px; transition: transform .08s, background .15s;
}
.pick:hover { background: #e9ecf4; }
.pick:active { transform: scale(.98); }
.pick .name { flex: 1; min-width: 0; }
.pick .name small { display: block; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.pick .chev { color: var(--blue); width: 22px; height: 22px; flex: none; }
.pick[disabled] { cursor: default; color: var(--muted); background: #f7f8fa; }
.pick[disabled] .avatar { filter: grayscale(1); opacity: .45; }
.pick .lock { font-size: 13px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }

.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; padding-bottom: 0; }
.member-row:first-of-type { padding-top: 0; }
.member-row .info { flex: 1; min-width: 0; }
.member-row .info b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.wait { background: var(--row); color: var(--muted); }
.member-actions { display: flex; gap: 6px; }
.mini-btn {
  border: 0; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 13.5px;
  padding: 8px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}

/* ---------- deseos (filas grises como en la referencia) ---------- */
.wish { display: flex; align-items: center; gap: 12px; background: var(--row); border-radius: 12px; padding: 10px; }
.wish .thumb {
  width: 58px; height: 58px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 26px;
  background: #fff; box-shadow: 0 2px 6px rgba(60,80,160,.08);
}
.wish .text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; font-size: 15.5px; }
.wish .meta { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.wish.deleted { background: #f7f8fa; }
.wish.deleted .text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.wish.deleted .meta { text-decoration: none; }
.wish.deleted .thumb { filter: grayscale(1); opacity: .5; }
.wish-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.amazon-btn {
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none; font-weight: 700; font-size: 13px;
  background: #232f3e; color: #fff; padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.amazon-btn .smile { color: #ff9900; font-weight: 900; font-size: 15px; line-height: 1; }
.trash-btn { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #fff; color: var(--red); display: grid; place-items: center; cursor: pointer; }
.trash-btn svg { width: 18px; height: 18px; }

.add-wish { display: flex; align-items: flex-start; gap: 8px; background: var(--row); border-radius: 12px; padding: 4px 4px 4px 12px; border: 2px solid transparent; transition: border-color .15s, background .15s; }
.add-wish:focus-within { border-color: var(--blue); background: #fff; }
.add-wish .plus { color: var(--blue); font-size: 24px; font-weight: 400; line-height: 1; padding-top: 11px; }
.add-wish textarea { flex: 1; border: 0; background: transparent; outline: none; resize: none; padding: 12px 4px; min-height: 46px; font-size: 16px; }
.add-wish textarea::placeholder { color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 18px 10px; }
.empty .emoji { font-size: 38px; display: block; margin-bottom: 6px; }

/* ---------- barra de navegación inferior ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff;
  box-shadow: 0 -4px 20px rgba(60,80,160,.10); padding-bottom: var(--safe-bottom);
}
.bottom-nav .inner { max-width: 520px; margin: 0 auto; display: flex; height: var(--nav-h); }
.nav-btn {
  flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: #9aa0b4; cursor: pointer; position: relative; font-size: 11.5px; font-weight: 700;
}
.nav-btn svg { width: 25px; height: 25px; }
.nav-btn.active { color: var(--blue); }
.nav-btn.active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
.nav-btn .count {
  position: absolute; top: 9px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--blue); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box;
}

/* ---------- revelado ---------- */
.reveal { text-align: center; padding-top: 8px; }
.reveal .hint { font-weight: 600; color: var(--muted); margin: 4px 0 0; font-style: italic; }
.gift-btn { background: none; border: 0; cursor: pointer; padding: 0; }
.gift-svg { width: 180px; height: 180px; display: block; margin: 0 auto; animation: wobble 2.4s ease-in-out infinite; }
.gift-svg .lid { transform-origin: 50% 40%; transition: transform .6s cubic-bezier(.3,1.6,.5,1); }
.opening .gift-svg { animation: none; }
.opening .gift-svg .lid { transform: translateY(-60px) rotate(-18deg); }
@keyframes wobble { 0%,100% { transform: rotate(0) } 10% { transform: rotate(-5deg) } 20% { transform: rotate(5deg) } 30% { transform: rotate(-3deg) } 40% { transform: rotate(0) } }

.match-card { text-align: center; padding-top: 24px; }
.match-card .label { color: var(--muted); font-weight: 600; margin: 14px 0 0; font-style: italic; }
.match-card .match-name { font-size: 34px; font-weight: 800; color: var(--blue); margin: 0; line-height: 1.15; overflow-wrap: anywhere; }
.pop { animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- notificaciones ---------- */
.notify { display: flex; align-items: center; gap: 12px; }
.notify .bell { width: 44px; height: 44px; border-radius: 12px; background: #fff6db; display: grid; place-items: center; font-size: 22px; flex: none; }
.notify .txt { flex: 1; }
.notify .txt b { display: block; }
.notify .txt small { color: var(--muted); font-size: 14px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d5d9e5; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; }
.note { font-size: 14px; color: #5d6279; background: #fff8e3; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* ---------- compartir ---------- */
.link-box {
  display: flex; align-items: center; gap: 8px; background: var(--row);
  border-radius: 10px; padding: 8px 8px 8px 12px; margin-bottom: 12px;
}
.link-box code { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #4b5170; }

.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: center; }
.step .num { width: 38px; height: 38px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 17px; flex: none; }
.step b { display: block; }
.step small { color: var(--muted); font-size: 14.5px; }

/* ---------- bottom sheet / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 35, 70, .42); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.modal {
  background: #fff; width: 100%; max-width: 520px; border-radius: 22px 22px 0 0;
  padding: 26px 20px calc(20px + var(--safe-bottom)); text-align: center; animation: up .25s ease-out;
}
.modal h3 { font-size: 22px; margin: 14px 0 6px; font-weight: 800; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal .btn + .btn { margin-top: 8px; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(100%) } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 15px;
  z-index: 60; box-shadow: 0 10px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); text-align: center; animation: fade .2s;
}
.toast.error { background: var(--red); }

.loading { display: grid; place-items: center; min-height: 70dvh; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #fff; border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

.footer-note { text-align: center; color: #6a7193; font-size: 13.5px; margin-top: 14px; }
.alert { background: #fff8e3; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; margin-bottom: 14px; position: relative; z-index: 2; }
.alert b { display: block; margin-bottom: 2px; }
