:root {
  /* paleta quente / aconchegante de cozinha */
  --cream: #fbf3e8;
  --cream-deep: #f4e6d4;
  --clay: #c25a37;
  --clay-deep: #a8482a;
  --terra: #e08a5b;
  --sage: #7c8c6b;
  --sage-deep: #5f6f50;
  --plum: #6c3b52;
  --ink: #3a2d24;
  --ink-soft: #7a6a5d;
  --gold: #d9a441;

  --shadow-sm: 0 2px 8px rgba(58, 45, 36, 0.08);
  --shadow-md: 0 14px 40px -12px rgba(58, 45, 36, 0.28);
  --shadow-lg: 0 30px 70px -20px rgba(58, 45, 36, 0.4);

  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Hanken Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 15% 0%, #fff8ef 0%, transparent 55%),
    radial-gradient(130% 100% at 100% 100%, #fbe7d0 0%, transparent 50%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* textura de grão sutil */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
}

/* blobs decorativos */
.bg-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.blob-1 {
  width: 420px;
  height: 420px;
  background: var(--terra);
  top: -140px;
  left: -120px;
  animation: float 18s var(--ease) infinite;
}
.blob-2 {
  width: 360px;
  height: 360px;
  background: var(--sage);
  bottom: -120px;
  right: -100px;
  opacity: 0.35;
  animation: float 22s var(--ease) infinite reverse;
}
.blob-3 {
  width: 280px;
  height: 280px;
  background: var(--gold);
  top: 45%;
  right: 12%;
  opacity: 0.18;
  animation: float 26s var(--ease) infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30px, -40px) scale(1.08);
  }
}

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 48px);
}

/* ─── telas ─── */
.screen {
  display: none;
  width: 100%;
  max-width: 560px;
  animation: screen-in 0.6s var(--ease) both;
}
.screen.is-active {
  display: block;
}
@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* ─── card de boas-vindas ─── */
.card--name {
  background: linear-gradient(180deg, #fffdf9, var(--cream));
  border: 1px solid rgba(194, 90, 55, 0.14);
  border-radius: var(--radius);
  padding: clamp(32px, 7vw, 56px);
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.card--name::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1.5px dashed rgba(194, 90, 55, 0.28);
  border-radius: calc(var(--radius) - 8px);
  pointer-events: none;
}

.eyebrow {
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 600;
}

.title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 11vw, 4rem);
  line-height: 0.98;
  color: var(--ink);
  margin: 10px 0 4px;
  letter-spacing: -0.01em;
}

.subtitle {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--plum);
}

.sprig {
  color: var(--sage);
  letter-spacing: 0.5em;
  font-size: 0.9rem;
  margin: 22px 0 26px;
}

.field-label {
  display: block;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.field {
  width: 100%;
  font-family: inherit;
  font-size: 1.1rem;
  padding: 15px 18px;
  border: 1.5px solid rgba(58, 45, 36, 0.16);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field::placeholder {
  color: #bcae9f;
}
.field:focus {
  outline: none;
  border-color: var(--clay);
  box-shadow: 0 0 0 4px rgba(194, 90, 55, 0.14);
}

.field-error {
  color: var(--clay-deep);
  font-size: 0.9rem;
  margin-top: 10px;
  text-align: left;
}

/* ─── botões ─── */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 1.02rem;
  border: none;
  border-radius: 14px;
  padding: 15px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn--primary {
  background: linear-gradient(135deg, var(--clay), var(--clay-deep));
  color: #fff;
  width: 100%;
  margin-top: 18px;
  box-shadow: 0 10px 24px -8px rgba(168, 72, 42, 0.6);
}
.btn--primary:hover {
  box-shadow: 0 14px 30px -8px rgba(168, 72, 42, 0.7);
}
.btn-arrow {
  transition: transform 0.25s var(--ease);
}
.btn--primary:hover .btn-arrow {
  transform: translateX(5px);
}
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid rgba(58, 45, 36, 0.18);
}
.btn--ghost:hover {
  background: rgba(58, 45, 36, 0.05);
}

/* ─── lista ─── */
.list-head {
  text-align: center;
  margin-bottom: 22px;
}
.list-head .eyebrow strong {
  color: var(--plum);
}
.list-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: clamp(2rem, 8vw, 2.8rem);
  margin: 6px 0 8px;
  letter-spacing: -0.01em;
}
.list-hint {
  color: var(--ink-soft);
  font-size: 0.96rem;
  max-width: 30ch;
  margin: 0 auto;
}

.list-status {
  text-align: center;
  color: var(--ink-soft);
  padding: 10px 0;
  min-height: 1.4em;
  font-size: 0.95rem;
}

.gift-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-head {
  --i: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 4px 4px;
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--plum);
  animation: gift-in 0.5s var(--ease) both;
  animation-delay: calc(min(var(--i), 14) * 45ms);
}
.cat-head:first-child {
  margin-top: 6px;
}
.cat-head::before {
  content: "✿";
  color: var(--sage);
  font-size: 1rem;
}
.cat-head::after {
  content: "";
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(108, 59, 82, 0.3), transparent);
}

.gift {
  --i: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffdf9;
  border: 1.5px solid rgba(58, 45, 36, 0.1);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.2s, border-color 0.2s;
  animation: gift-in 0.5s var(--ease) both;
  animation-delay: calc(min(var(--i), 14) * 45ms);
}
@keyframes gift-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
.gift:hover {
  transform: translateY(-2px);
  border-color: rgba(194, 90, 55, 0.4);
  box-shadow: var(--shadow-md);
}

.gift-name {
  flex: 1;
  font-weight: 600;
  font-size: 1.08rem;
}
.gift-tag {
  flex: none;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage-deep);
  background: rgba(124, 140, 107, 0.16);
  border: 1px solid rgba(124, 140, 107, 0.35);
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.gift-pick {
  flex: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--clay);
  border: 1.5px solid rgba(194, 90, 55, 0.35);
  border-radius: 999px;
  padding: 7px 16px;
  background: #fff;
  transition: background 0.2s, color 0.2s;
}
.gift:hover .gift-pick {
  background: var(--clay);
  color: #fff;
}

/* item sendo riscado e removido */
.gift.is-taken {
  pointer-events: none;
}
.gift.is-taken .gift-name {
  text-decoration: line-through;
  text-decoration-color: var(--clay);
  text-decoration-thickness: 2px;
  color: var(--ink-soft);
}
/* flash de confirmação para itens repetíveis (não some) */
.gift.confirmed {
  border-color: var(--sage);
  background: linear-gradient(180deg, #f1f5ec, #fffdf9);
  animation: confirm-pulse 0.5s var(--ease);
}
.gift.confirmed .gift-pick {
  background: var(--sage-deep);
  color: #fff;
  border-color: var(--sage-deep);
}
@keyframes confirm-pulse {
  40% {
    transform: scale(1.02);
    box-shadow: 0 12px 30px -10px rgba(124, 140, 107, 0.6);
  }
}

.gift.removing {
  animation: gift-out 0.6s var(--ease) forwards;
}
@keyframes gift-out {
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: -12px;
  }
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-soft);
}
.empty .emoji {
  font-size: 2.6rem;
  display: block;
  margin-bottom: 10px;
}
.empty strong {
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  color: var(--ink);
  display: block;
}

.footer-note {
  text-align: center;
  margin-top: 26px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.link-btn {
  background: none;
  border: none;
  color: var(--clay);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(58, 45, 36, 0.46);
  backdrop-filter: blur(4px);
  animation: fade 0.25s ease both;
}
/* o atributo [hidden] precisa vencer o display:grid acima */
.modal-backdrop[hidden] {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  background: linear-gradient(180deg, #fffdf9, var(--cream));
  border-radius: var(--radius);
  padding: 40px 30px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: pop 0.4s var(--ease) both;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
}
.modal-ribbon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}
.modal-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.modal-text {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 26px;
}
.modal-text strong {
  color: var(--plum);
}
.modal-note {
  font-size: 0.9rem;
  color: var(--sage-deep);
  background: rgba(124, 140, 107, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  margin: -14px 0 22px;
}
.modal-actions {
  display: flex;
  gap: 12px;
}
.modal-actions .btn {
  flex: 1;
  margin-top: 0;
}

/* spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── toast ─── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  z-index: 60;
  background: var(--ink);
  color: #fff8ef;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--ease);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast--ok {
  background: var(--sage-deep);
}
.toast.toast--err {
  background: var(--clay-deep);
}

/* ════════════════════════════════════════════════════════════════════════
 *  CAMADA DE MOVIMENTO — entradas escalonadas + micro-interações
 * ════════════════════════════════════════════════════════════════════════ */

/* entrada escalonada dos elementos do card de boas-vindas */
.card--name > * {
  animation: rise 0.7s var(--ease) both;
}
.card--name .eyebrow {
  animation-delay: 0.08s;
}
.card--name .title {
  animation-delay: 0.18s;
}
.card--name .subtitle {
  animation-delay: 0.28s;
}
.card--name .sprig {
  animation-delay: 0.38s;
}
.card--name form {
  animation-delay: 0.48s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* cabeçalho da lista entra suave */
.list-head > * {
  animation: rise 0.6s var(--ease) both;
}
.list-head .eyebrow {
  animation-delay: 0.05s;
}
.list-head .list-title {
  animation-delay: 0.13s;
}
.list-head .list-hint {
  animation-delay: 0.22s;
}

/* a florzinha do card respira */
.sprig {
  display: inline-block;
}
.card--name .sprig {
  animation: rise 0.7s var(--ease) both, breathe 4s ease-in-out 1s infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: translateY(0);
    letter-spacing: 0.5em;
  }
  50% {
    transform: translateY(-3px);
    letter-spacing: 0.62em;
  }
}

/* o laço do modal balança de leve */
.modal-ribbon {
  display: inline-block;
  animation: sway 2.6s ease-in-out infinite;
}
@keyframes sway {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }
  50% {
    transform: translateY(-5px) rotate(5deg);
  }
}

/* ─── itens da lista: hover mais vivo ─── */
.gift {
  position: relative;
  overflow: hidden;
}
.gift::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(180deg, var(--clay), var(--terra));
  transition: width 0.28s var(--ease);
}
.gift:hover::before,
.gift:focus-within::before {
  width: 5px;
}
.gift-name {
  transition: transform 0.28s var(--ease), color 0.2s;
}
.gift:hover .gift-name {
  transform: translateX(8px);
}
.gift:active {
  transform: scale(0.99);
}
.gift-pick {
  transition: background 0.2s, color 0.2s, transform 0.22s var(--ease),
    box-shadow 0.22s;
}
.gift:hover .gift-pick {
  transform: scale(1.06);
  box-shadow: 0 6px 16px -6px rgba(194, 90, 55, 0.6);
}

/* linha da categoria "desenha" da esquerda pra direita */
.cat-head::after {
  transform: scaleX(0);
  transform-origin: left;
  animation: draw-line 0.7s var(--ease) both;
  animation-delay: calc(min(var(--i), 14) * 45ms + 0.15s);
}
@keyframes draw-line {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

/* botão primário: gradiente que desliza no hover */
.btn--primary {
  background-size: 180% 180%;
  background-position: 0% 50%;
  transition: transform 0.15s var(--ease), box-shadow 0.25s,
    background-position 0.5s var(--ease);
}
.btn--primary:hover {
  background-position: 100% 50%;
}

/* ════════════════════════════════════════════════════════════════════════
 *  PAINEL DO ADMIN
 * ════════════════════════════════════════════════════════════════════════ */
.btn--small {
  width: auto;
  margin-top: 14px;
  padding: 9px 18px;
  font-size: 0.92rem;
}

.admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(194, 90, 55, 0.14);
  color: var(--clay-deep);
  border: 1px solid rgba(194, 90, 55, 0.28);
}
.pill--sage {
  background: rgba(124, 140, 107, 0.16);
  color: var(--sage-deep);
  border-color: rgba(124, 140, 107, 0.35);
}
.pill--ghost {
  background: rgba(58, 45, 36, 0.06);
  color: var(--ink-soft);
  border-color: rgba(58, 45, 36, 0.14);
}

/* linhas do admin: empilham nome + meta */
.gift--admin {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  cursor: default;
}
.gift--admin:hover {
  transform: none;
  border-color: rgba(58, 45, 36, 0.1);
  box-shadow: var(--shadow-sm);
}
.gift--admin:hover::before {
  width: 0;
}
.gift--admin .gift-name {
  transform: none !important;
}
.admin-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-meta--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-tag {
  font-size: 0.9rem;
  font-weight: 500;
}
.status--free {
  color: var(--ink-soft);
}
.status--taken {
  color: var(--clay-deep);
  font-weight: 600;
}
.status--mult {
  color: var(--sage-deep);
  font-weight: 600;
}

.gift-pick--release {
  cursor: pointer;
  border-color: rgba(194, 90, 55, 0.4);
  flex: none;
}
.gift-pick--release:hover {
  background: var(--clay);
  color: #fff;
}

/* chips de quem escolheu (itens repetíveis) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid rgba(124, 140, 107, 0.4);
  border-radius: 999px;
  padding: 5px 6px 5px 13px;
  font-size: 0.9rem;
}
.chip-name {
  font-weight: 600;
}
.chip-when {
  color: var(--ink-soft);
  font-size: 0.8rem;
}
.chip-x {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(194, 90, 55, 0.12);
  color: var(--clay-deep);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.chip-x:hover {
  background: var(--clay);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  /* desliga só as animações decorativas em loop / entradas;
     mantém as transições de hover e interação fluidas */
  .blob,
  .card--name .sprig,
  .modal-ribbon {
    animation: none !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
