:root {
  --g1: #1b7a4b; --g2: #0c4a2c; --red: #e11d2e; --red2: #b3121f; --gold: #ffc93c; --gold2: #c9971a;
  --cream: #fff7e3; --ink: #2b1d16; --line: #ead9ae; --ribbon: #1faa59;
  --hand: 'Caveat', 'Segoe Script', cursive;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 500 16px/1.45 'Fredoka', system-ui, sans-serif; color: #fff; min-height: 100dvh; overflow-x: hidden;
  background: radial-gradient(120% 80% at 50% 0, var(--g1), var(--g2)) fixed var(--g2);
}
button, input, select { font: inherit; color: inherit; }
ul, ol, menu { list-style: none; padding: 0; }
a { color: inherit; }

/* neve */
body::before, body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; --s: 280px;
  background-image:
    radial-gradient(3px 3px at 30px 40px, #fffc, transparent), radial-gradient(2px 2px at 110px 150px, #fff9, transparent),
    radial-gradient(4px 4px at 190px 80px, #fff8, transparent), radial-gradient(2px 2px at 240px 220px, #fffa, transparent);
  background-size: var(--s) var(--s); animation: snow 16s linear infinite;
}
body::after { --s: 420px; animation-duration: 26s; opacity: .6; }
@keyframes snow { to { background-position: var(--s) var(--s); } }

/* pisca-pisca */
.lights { position: fixed; inset: 0 0 auto; height: 26px; z-index: 3; pointer-events: none; border-top: 3px solid #06301c; }
.lights::before, .lights::after { content: ''; position: absolute; inset: 0; background-size: 96px 26px; animation: blink 1.4s steps(1) infinite; }
.lights::before { background-image: radial-gradient(circle at 12px 9px, var(--gold) 6px, transparent 7px), radial-gradient(circle at 60px 12px, #ff5964 6px, transparent 7px); filter: drop-shadow(0 0 6px var(--gold)); }
.lights::after { background-image: radial-gradient(circle at 36px 12px, #6ee7ff 6px, transparent 7px), radial-gradient(circle at 84px 9px, #fff 6px, transparent 7px); filter: drop-shadow(0 0 6px #fff); animation-delay: -.7s; }
@keyframes blink { 50% { opacity: .3; } }

#app { position: relative; z-index: 1; max-width: 1060px; margin: 0 auto; padding: 42px 16px 56px; }
.page { display: grid; gap: 18px; animation: rise .5s cubic-bezier(.2, 1.1, .4, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
@keyframes bob { 50% { translate: 0 -6px; } }

h1 { font-size: clamp(2.3rem, 8vw, 4.2rem); font-weight: 700; line-height: 1; text-shadow: 0 4px 0 #0003; text-wrap: balance; }
h1 span { color: var(--gold); font-family: var(--hand); font-size: 1.2em; }
h2 { font-size: 1.3rem; font-weight: 600; }
h2 small { font-size: .85rem; font-weight: 500; opacity: .65; margin-left: 6px; }
.hint { font-size: .9rem; opacity: .75; }

.santa { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 10px 14px #0005); animation: bob 3.2s ease-in-out infinite; }
.santa .arm { transform-origin: 82px 152px; animation: wave 2.6s ease-in-out infinite; }
@keyframes wave { 50% { transform: rotate(-12deg); } }

.av { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; }

.card { background: var(--cream); color: var(--ink); border-radius: 28px; padding: clamp(18px, 4vw, 30px); box-shadow: 0 20px 50px #0006; display: grid; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gold); color: var(--ink); font-weight: 700; text-decoration: none; box-shadow: 0 5px 0 var(--gold2); transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold2); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.big { font-size: 1.25rem; padding: 16px 34px; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.sm { padding: 7px 14px; font-size: .88rem; box-shadow: none; }
.btn.danger { background: #fde3e3; color: var(--red2); }
.btn.wa { background: #25d366; color: #073b1c; box-shadow: 0 5px 0 #159e48; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.card :focus-visible, dialog :focus-visible { outline-color: var(--red); }

label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
input:not([type=checkbox]), select {
  width: 100%; min-width: 0; padding: 11px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; font-size: 1rem;
}
input:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 4px #ffc93c55; }
/* calendário */
.date { position: relative; display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.date-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 11px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: #a89f8c; font-size: 1rem; font-weight: 500; cursor: pointer; text-align: left;
}
.date-btn.filled { color: var(--ink); }
.date-btn[aria-expanded=true] { border-color: var(--gold); box-shadow: 0 0 0 4px #ffc93c55; }
.date-btn b { font-weight: 400; }
.cal {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: 296px; max-width: calc(100vw - 40px); padding: 14px;
  background: #fff; border-radius: 22px; box-shadow: 0 18px 44px #0005, 0 0 0 2px var(--line); animation: pop .22s cubic-bezier(.2, 1.4, .4, 1); transform-origin: top right;
}
.cal header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal header b { text-transform: capitalize; font-size: 1.05rem; }
.cal header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f6ecd2; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.cal header button:hover { background: var(--gold); }
.wk, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.wk span { font-size: .78rem; color: #a89f8c; padding: 4px 0; }
.wk span:first-child, .days button:nth-child(7n + 1) { color: var(--red2); }
.days button { aspect-ratio: 1; border: 0; border-radius: 50%; background: none; font-weight: 500; cursor: pointer; transition: background .12s; }
.days button:hover { background: #fdf1cf; }
.days .today { box-shadow: inset 0 0 0 2px var(--gold); }
.days .sel, .days .sel:hover { background: var(--red); color: #fff !important; font-weight: 700; }
.cal footer { display: flex; justify-content: space-between; margin-top: 8px; }
.cal footer button { border: 0; background: none; padding: 6px 10px; border-radius: 10px; font-weight: 600; color: var(--red2); cursor: pointer; }
.cal footer button:hover { background: #fde3e3; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--red); }

/* início */
.hero { display: flex; align-items: center; gap: 16px; }
.hero .santa { flex: 0 0 clamp(110px, 30vw, 300px); width: clamp(110px, 30vw, 300px); }
.hero p { margin-top: 12px; font-size: 1.05rem; opacity: .9; max-width: 34ch; }
.col { display: grid; gap: 22px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 > :last-child { grid-column: 1 / -1; }
#people { display: grid; gap: 10px; }
.person {
  display: grid; grid-template: 'av name rm' 'av fam fam' 'child child child' / 52px 1fr 36px; gap: 8px 10px; align-items: center;
  padding: 10px; border-radius: 18px; background: #fff; border: 2px solid var(--line); border-left: 8px solid var(--fam, var(--line));
}
.person.new { animation: rise .35s both; }
.av-btn { grid-area: av; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; transition: transform .15s; }
.av-btn:hover { transform: scale(1.08) rotate(-4deg); }
.av-btn:active { transform: scale(.92); }
.person .name { grid-area: name; }
.person .fam { grid-area: fam; padding-block: 7px; font-size: .9rem; }
.rm { grid-area: rm; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f6ecd2; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.rm:hover { background: #fde3e3; color: var(--red2); }
.child { grid-area: child; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.mine a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--line); text-decoration: none; font-weight: 600; }
.mine a span { color: var(--red2); white-space: nowrap; }

/* cabeçalho do evento */
.event { text-align: center; display: grid; gap: 12px; justify-items: center; }
.event h1 { font-size: clamp(2rem, 7vw, 3.4rem); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips span { background: #0004; border: 1px solid #fff3; padding: 5px 14px; border-radius: 999px; font-size: .92rem; }
.sub { font-size: 1.1rem; }
.sub b { color: var(--gold); }

/* painel do organizador */
.admin, .pick, .oops { max-width: 640px; margin: 0 auto; width: 100%; }
.share { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.share .btn { padding-inline: 12px; }
.share input { grid-column: 1 / -1; font-size: .9rem; }
.bar { height: 12px; border-radius: 99px; background: #eadfbf; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--ribbon), #7ddc9c); transition: width .6s; }
.status { display: grid; gap: 10px; }
.status li { display: grid; grid-template: 'av who badges' 'deleg deleg unlink' / 44px 1fr auto; gap: 8px 10px; align-items: center; padding: 10px 12px; border-radius: 18px; background: #fff; border: 2px solid var(--line); }
.status .av { grid-area: av; }
.who { grid-area: who; display: grid; min-width: 0; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who i { font-style: normal; font-size: .8rem; color: var(--fam); font-weight: 600; }
.badges { grid-area: badges; display: grid; gap: 4px; justify-items: end; }
.badges span { font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: #f1e8cf; color: #7a6a45; white-space: nowrap; }
.badges .ok { background: #d5f2df; color: #0b6b34; }
.deleg { grid-area: deleg; font-weight: 500; font-size: .8rem; opacity: .9; }
.deleg select { padding: 6px 10px; font-size: .9rem; }
.status .btn { grid-area: unlink; align-self: end; }

/* quem é você */
.hello { display: flex; align-items: center; gap: 6px; }
.hello .santa { flex: 0 0 110px; width: 110px; }
.bubble { position: relative; background: var(--cream); color: var(--ink); padding: 14px 18px; border-radius: 22px; font-size: 1.15rem; box-shadow: 0 10px 24px #0004; }
.bubble::before { content: ''; position: absolute; left: -9px; top: 50%; border: 10px solid transparent; border-right-color: var(--cream); border-left: 0; translate: 0 -50%; }
.bubble small { display: block; font-size: .85rem; opacity: .7; }
.names { display: grid; gap: 10px; }
.names li { animation: rise .4s both; animation-delay: calc(var(--i) * 45ms); }
.names button {
  width: 100%; display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; text-align: left; padding: 10px 18px 10px 10px; border: 0; border-radius: 999px;
  background: var(--cream); color: var(--ink); cursor: pointer; box-shadow: 0 5px 0 #d9c890; transition: transform .12s, box-shadow .12s, background .12s;
}
.names b { font-family: var(--hand); font-size: 1.7rem; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.names span { font-size: .85rem; font-weight: 600; color: var(--red2); }
.names button:hover:not(:disabled) { background: var(--gold); transform: translateY(-2px); }
.names button:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #d9c890; }
.names button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.names button:disabled span { color: inherit; }
.pick .hint, .play .hint { text-align: center; }

/* sorteador */
.play { justify-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tabs button { padding: 8px 18px; border-radius: 99px; border: 2px solid #fff5; background: #0003; cursor: pointer; font-weight: 600; }
.tabs .on { background: var(--gold); border-color: var(--gold); color: var(--ink); }
/* mais alto que largo, como os cartões: sobra espaço vertical nas laterais do anel */
.stage { position: relative; width: min(100%, 560px, 54dvh); aspect-ratio: 1 / 1.25; container-type: inline-size; }
.stage::before { content: ''; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(#ffe9a855, transparent 68%); animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { scale: 1.15; opacity: .6; } }
.pcard { position: absolute; left: 50%; top: 50%; width: var(--cw, 90px); font-size: calc(var(--cw, 90px) * .2); z-index: 2; will-change: transform; }
.pcard > div {
  position: relative; background: var(--cream); color: var(--ink); border-radius: .5em; padding: .7em .55em .3em; text-align: center; box-shadow: 0 .3em .8em #0005;
  animation: bob 3.4s ease-in-out infinite; animation-delay: calc(var(--k) * -.47s); transition: scale .15s, background .15s, box-shadow .3s;
}
.pcard > div::before { content: ''; position: absolute; top: -.45em; left: 50%; width: 1.9em; height: .9em; translate: -50% 0; rotate: -3deg; background: #ffd95ccc; border-radius: 2px; }
.pcard .av { width: 72%; margin: 0 auto; }
.pcard b { display: block; font-family: var(--hand); font-size: 1.25em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.self > div { background: var(--gold); }
.pcard.hot { z-index: 4; }
.pcard.hot > div { background: #fff; scale: 1.14; box-shadow: 0 0 0 .2em var(--gold), 0 0 1.6em var(--gold); }
.pcard.chosen { z-index: 5; }
.pcard.chosen > div { box-shadow: 0 0 0 .22em var(--gold), 0 0 2em var(--gold); animation: bob 3.4s ease-in-out infinite, chosen .9s ease-in-out 3; }
@keyframes chosen { 50% { scale: 1.2; } }

.gift { position: absolute; left: 50%; top: 53%; width: 34cqw; aspect-ratio: 1 / .95; translate: -50% -50%; z-index: 3; transition: scale .7s cubic-bezier(.3, 1.5, .5, 1) .2s; animation: wiggle 4s ease-in-out infinite; }
@keyframes wiggle { 0%, 84%, 100% { rotate: 0deg; } 88% { rotate: -5deg; } 92% { rotate: 5deg; } 96% { rotate: -3deg; } }
.gift .box, .gift .lid { position: absolute; background: linear-gradient(90deg, transparent 39%, var(--ribbon) 39% 61%, transparent 61%), linear-gradient(165deg, #f5414c, var(--red2)); }
.gift .box { inset: 34% 4% 0; border-radius: 1.5cqw 1.5cqw 3cqw 3cqw; box-shadow: inset 0 -3cqw 5cqw #0003, 0 3cqw 5cqw #0006; z-index: 2; }
.gift .lid { inset: 14% -2% 66%; border-radius: 1.5cqw; box-shadow: 0 1cqw 0 #0003; z-index: 4; transition: transform .8s cubic-bezier(.3, 1.5, .5, 1); }
.gift .lid::before, .gift .lid::after { content: ''; position: absolute; bottom: 92%; left: 50%; width: 9cqw; height: 7.5cqw; border: 2.2cqw solid var(--ribbon); border-radius: 50%; transform-origin: 0 100%; }
.gift .lid::before { transform: rotate(18deg); }
.gift .lid::after { transform: rotate(-18deg) translateX(-100%); transform-origin: 0 100%; }
.note {
  position: absolute; inset: 30% 9% 10%; display: grid; align-content: center; gap: .2em; text-align: center; background: var(--cream); color: var(--ink); border-radius: 1cqw;
  z-index: 1; opacity: 0; box-shadow: 0 0 4cqw #ffe9a8; transition: translate .9s cubic-bezier(.3, 1.4, .5, 1) .35s, opacity .2s .3s;
}
.note small { font-size: 2.9cqw; font-weight: 600; }
.note b { font-family: var(--hand); font-size: calc(9.5cqw * var(--fit, 1)); line-height: 1; color: var(--red); white-space: nowrap; }
.stage.open .gift { scale: 1.3; z-index: 30; animation: none; }
.stage.open .lid { transform: translate(-8%, -235%) rotate(-12deg); }
.stage.open .note { translate: 0 -76%; opacity: 1; }
.confetti { position: absolute; left: 50%; top: 45%; width: 10px; height: 14px; border-radius: 2px; z-index: 40; pointer-events: none; }
.cta { display: grid; gap: 10px; justify-items: center; min-height: 96px; align-content: start; }
#go { animation: pulse 1.6s ease-in-out infinite; }
#go:disabled { animation: none; }
@keyframes pulse { 50% { box-shadow: 0 5px 0 var(--gold2), 0 0 0 12px #ffc93c33; } }
.done { font-size: 1.25rem; text-align: center; text-wrap: balance; animation: pop .5s both; }
.done b { font-family: var(--hand); font-size: 1.6em; color: var(--gold); margin-right: .12em; }

.oops { text-align: center; justify-items: center; }
.oops .santa { width: 180px; }

dialog { margin: auto; border: 0; border-radius: 28px; padding: 26px; width: min(92vw, 400px); background: var(--cream); color: var(--ink); text-align: center; box-shadow: 0 30px 80px #000a; }
dialog[open] { animation: pop .3s cubic-bezier(.2, 1.4, .4, 1); }
dialog::backdrop { background: #062a18cc; backdrop-filter: blur(4px); }
dialog form { display: grid; gap: 12px; }
dialog h3 { font-size: 1.5rem; }
dialog menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.ask-av { width: 96px; margin: 0 auto; }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: 92vw; padding: 12px 20px; border-radius: 99px; background: var(--ink); color: #fff; font-weight: 600; text-align: center; translate: -50% 150%; opacity: 0; transition: translate .35s cubic-bezier(.2, 1.3, .4, 1), opacity .2s; }
#toast.show { translate: -50% 0; opacity: 1; }

@media (min-width: 560px) {
  .grid3 { grid-template-columns: 1fr 1fr 1.3fr; }
  .grid3 > :last-child { grid-column: auto; }
  .person { grid-template: 'av name fam rm' 'child child child child' / 52px 1fr 150px 36px; }
  .share { grid-template-columns: 1fr auto auto auto; }
  .share input { grid-column: auto; }
  .status li { grid-template: 'av who badges' 'av deleg unlink' / 52px 1fr auto; }
  .badges { display: flex; }
}
@media (min-width: 920px) {
  .home { grid-template-columns: 1fr 1.2fr; gap: 44px; align-items: start; }
  .home .hero { position: sticky; top: 56px; flex-direction: column; text-align: center; }
  .home .hero p { margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
