:root {
  --bg: #fff7e6;
  --ink: #2d2350;
  --muted: #6d6490;
  --purple: #7c4dff;
  --pink: #ff5fa2;
  --orange: #ff9f1c;
  --yellow: #ffd23f;
  --green: #2ec4b6;
  --blue: #3a86ff;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(45, 35, 80, .12), 0 12px 28px rgba(45, 35, 80, .10);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Fredoka', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  font-size: 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #ffe1f0 0 120px, transparent 121px),
    radial-gradient(circle at 90% 30%, #e0f7ff 0 160px, transparent 161px),
    radial-gradient(circle at 20% 90%, #e9e1ff 0 140px, transparent 141px),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
main { max-width: 1040px; margin: 0 auto; padding: 16px 16px 40px; position: relative; z-index: 1; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; }
h1 { font-size: 2rem; }
a { color: var(--purple); }
small { color: var(--muted); font-weight: 400; }
.sub { color: var(--muted); margin-top: 0; }

/* floating background bubbles */
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bubbles span {
  position: absolute; bottom: -80px; width: 40px; height: 40px; border-radius: 50%;
  opacity: .25; animation: rise 18s linear infinite;
}
.bubbles span:nth-child(1) { left: 8%;  background: var(--pink);   animation-delay: 0s; }
.bubbles span:nth-child(2) { left: 25%; background: var(--yellow); animation-delay: 4s; width: 24px; height: 24px; }
.bubbles span:nth-child(3) { left: 45%; background: var(--green);  animation-delay: 8s; }
.bubbles span:nth-child(4) { left: 65%; background: var(--blue);   animation-delay: 2s; width: 30px; height: 30px; }
.bubbles span:nth-child(5) { left: 80%; background: var(--orange); animation-delay: 11s; }
.bubbles span:nth-child(6) { left: 92%; background: var(--purple); animation-delay: 6s; width: 20px; height: 20px; }
@keyframes rise { to { transform: translateY(-120vh) rotate(360deg); } }

/* header */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.08);
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.6rem; display: flex; align-items: center; gap: 8px; }
.brand-gift { display: inline-block; animation: wiggle 3s ease-in-out infinite; }
.who { display: flex; align-items: center; gap: 10px; }
.who form { margin: 0; }
.avatar-badge {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; font-size: 26px; box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.hi { font-size: 1.05rem; }

/* cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin: 20px 0; border: 3px solid #f0e8ff;
}
.auth { max-width: 460px; margin: 32px auto; text-align: center; }
.auth .stack { text-align: left; }
.auth-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; }
.switch { margin-top: 18px; }

/* forms */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; }
input[type=text], input:not([type]), input[type=password], input[type=url] {
  font: inherit; font-weight: 400; font-size: 1.05rem;
  padding: 12px 14px; border-radius: 14px; border: 3px solid #e6dcff; background: #fcfaff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(124,77,255,.18); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
details { background: #faf7ff; border-radius: 14px; padding: 10px 14px; }
details[open] { display: grid; gap: 12px; }
summary { cursor: pointer; font-weight: 600; color: var(--purple); }

/* star chips */
.stars-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.stars-picker legend { width: 100%; }
.chip input, .avatar-picker input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 8px 14px; border-radius: 999px; font-weight: 500;
  background: #fff4d6; border: 3px solid #ffe8a3; cursor: pointer; transition: transform .1s;
}
.chip input:checked + span { background: var(--yellow); border-color: var(--orange); transform: scale(1.06); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px rgba(124,77,255,.3); }

/* avatar picker */
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.avatar-picker legend { grid-column: 1 / -1; }
.avatar-picker label { display: block; }
.avatar-picker span {
  display: grid; place-items: center; height: 54px; font-size: 30px; border-radius: 16px;
  background: #f5f0ff; border: 3px solid transparent; cursor: pointer; transition: transform .15s;
}
.avatar-picker span:hover { transform: scale(1.1) rotate(-6deg); }
.avatar-picker input:checked + span { border-color: var(--purple); background: #e9e1ff; transform: scale(1.12); }
.avatar-picker input:focus-visible + span { box-shadow: 0 0 0 4px rgba(124,77,255,.3); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  color: #fff; background: var(--purple); border: 0; border-radius: 14px; padding: 10px 18px;
  box-shadow: 0 4px 0 #5a2fd6; transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5a2fd6; }
.btn-big { font-size: 1.25rem; padding: 14px 22px; background: linear-gradient(90deg, var(--pink), var(--orange)); box-shadow: 0 5px 0 #d9446f; }
.btn-big:active { box-shadow: 0 1px 0 #d9446f; }
.btn-small { font-size: .9rem; padding: 7px 12px; border-radius: 12px; }
.btn-ghost { background: #fff; color: var(--purple); box-shadow: 0 3px 0 #d8ccff; }
.btn-ghost:active { box-shadow: 0 1px 0 #d8ccff; }
.topbar .btn-ghost { box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.btn-danger { background: #fff0f3; color: #d6336c; box-shadow: 0 3px 0 #ffc9d6; }

/* flash */
.flash { padding: 12px 16px; border-radius: 14px; margin: 16px 0; font-weight: 500; animation: pop .35s ease-out; }
.flash-success { background: #d8f8ef; border: 3px solid var(--green); }
.flash-info { background: #e3efff; border: 3px solid var(--blue); }
.flash-error { background: #ffe3ea; border: 3px solid #ff6b8a; }

/* list header */
.list-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.list-head h2 { margin: 0; font-size: 1.6rem; }
.count { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 999px; background: var(--yellow); font-size: 1.1rem; vertical-align: middle; }
.sorter { display: flex; gap: 6px; background: #fff; padding: 5px; border-radius: 999px; box-shadow: var(--shadow); }
.sorter a { text-decoration: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.sorter a.active { background: var(--purple); color: #fff; }

/* wish grid */
.grid { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.wish {
  --c: var(--pink);
  background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  border: 4px solid var(--c); display: flex; flex-direction: column;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  animation: pop .4s ease-out backwards;
}
.wish:nth-child(odd)  { transform: rotate(-1deg); }
.wish:nth-child(even) { transform: rotate(1deg); }
.wish:hover { transform: rotate(0) scale(1.04); z-index: 1; }
.wish.c0 { --c: var(--pink); }   .wish.c1 { --c: var(--blue); }  .wish.c2 { --c: var(--orange); }
.wish.c3 { --c: var(--green); }  .wish.c4 { --c: var(--purple); } .wish.c5 { --c: var(--yellow); }
.wish:nth-child(2) { animation-delay: .05s; } .wish:nth-child(3) { animation-delay: .1s; }
.wish:nth-child(4) { animation-delay: .15s; } .wish:nth-child(5) { animation-delay: .2s; }

.pic { position: relative; aspect-ratio: 1 / 1; background: color-mix(in srgb, var(--c) 18%, white); display: grid; place-items: center; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 10px; }
.pic-fallback { font-size: 72px; animation: float 3s ease-in-out infinite; }
.badge-stars { position: absolute; top: 10px; right: 10px; background: #fff; border-radius: 999px; padding: 2px 10px; font-size: .9rem; box-shadow: 0 2px 0 rgba(0,0,0,.1); }

.wish .body { padding: 14px 16px 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.wish h3 { font-size: 1.2rem; margin: 0; word-break: break-word; }
.notes { margin: 0; color: var(--muted); font-size: .95rem; }
.shop { font-weight: 600; text-decoration: none; }
.shop:hover { text-decoration: underline; }
.star-row { display: flex; gap: 2px; margin: 0; }
.star { font-size: 1.6rem; line-height: 1; background: none; border: 0; padding: 0 2px; cursor: pointer; color: #e3dcef; transition: transform .15s; }
.star.on { color: var(--yellow); text-shadow: 0 2px 0 var(--orange); }
.star:hover { transform: scale(1.3) rotate(15deg); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; }
.actions form { margin: 0; }

.empty { text-align: center; padding: 40px 20px; }
.empty-emoji { font-size: 80px; }
.preview { max-width: 220px; border-radius: 16px; overflow: hidden; border: 3px solid #e6dcff; }
.preview img { display: block; width: 100%; }
.foot { text-align: center; color: var(--muted); padding: 20px; position: relative; z-index: 1; }

/* sharing */
.share-card h2 { font-size: 1.4rem; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-url {
  flex: 1 1 260px; min-width: 0; font: inherit; font-size: .95rem;
  padding: 11px 14px; border-radius: 14px; border: 3px dashed var(--pink); background: #fff5fa; color: var(--ink);
}
.share-actions { margin-top: 12px; }
.send-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; animation: pop .25s ease-out; }
.send-whatsapp { background: #25d366; box-shadow: 0 3px 0 #1a9e4b; }
.send-email { background: var(--blue); box-shadow: 0 3px 0 #2563c9; }
.send-sms { background: var(--green); box-shadow: 0 3px 0 #1f9086; }
@media (hover: hover) and (pointer: fine) { .send-sms { display: none; } }
.shared-hero { display: flex; align-items: center; gap: 18px; }
.shared-hero h1 { margin-bottom: 4px; }
.shared-hero .sub { margin: 0; }
.shared-avatar {
  flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  font-size: 52px; background: linear-gradient(135deg, #ffe1f0, #e9e1ff); box-shadow: var(--shadow);
}
.want { margin: 0; font-weight: 600; color: var(--orange); }
.cta { text-align: center; }
.cta p { font-size: 1.2rem; margin-top: 0; }

/* animations */
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-15deg); } 90% { transform: rotate(12deg); } 95% { transform: rotate(-6deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.bounce { animation: float 2s ease-in-out infinite; }
.float { animation: float 3s ease-in-out infinite; }
.btn.loading { pointer-events: none; opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .wish { transform: none !important; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  h1 { font-size: 1.6rem; }
  .card { padding: 18px; }
  .hi { display: none; }
}
