:root {
  --night: #0d2740;
  --pine: #12432f;
  --card: #fffaf0;
  --ink: #1d2721;
  --muted: #55615a;
  --green: #1c6b47;
  --green-deep: #123c29;
  --red: #c1272d;
  --red-deep: #8f1d16;
  --gold: #e3b341;
  --gold-deep: #b58a1f;
  --line: #e6dac2;
  --field: #8c8069;
  --snow: #f4efe4;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--night);
  background: linear-gradient(180deg, #0a1f36 0%, var(--night) 35%, var(--pine) 100%) fixed;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}
html[lang=fa] body {
  font-family: Vazirmatn, "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  line-height: 1.8;
}

/* ---------- snow ---------- */
.snow { position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.flake {
  position: absolute;
  top: -2rem;
  color: #fff;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes fall {
  0% { transform: translate(0, -5vh) rotate(0deg); }
  50% { transform: translate(1.5rem, 50vh) rotate(160deg); }
  100% { transform: translate(-1rem, 108vh) rotate(320deg); }
}

/* ---------- top of the page ---------- */
.top { position: relative; z-index: 1; text-align: center; padding: 0 1rem 1rem; color: #fff; }
.lights { position: relative; height: 2rem; margin: 0 -1rem .35rem; border-top: 2px solid rgba(255, 255, 255, .3); }
.lights::before, .lights::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1.4rem;
  background-repeat: repeat-x;
  background-size: 8rem 1.4rem;
  animation: twinkle 1.5s ease-in-out infinite alternate;
}
.lights::before {
  background-image:
    radial-gradient(ellipse .34rem .46rem at 1rem .6rem, #ff5a4d 96%, transparent 100%),
    radial-gradient(ellipse .34rem .46rem at 5rem .6rem, #ffd257 96%, transparent 100%);
}
.lights::after {
  background-image:
    radial-gradient(ellipse .34rem .46rem at 3rem .6rem, #5fe094 96%, transparent 100%),
    radial-gradient(ellipse .34rem .46rem at 7rem .6rem, #6cc4ff 96%, transparent 100%);
  animation-direction: alternate-reverse;
}
@keyframes twinkle {
  from { opacity: 1; filter: drop-shadow(0 0 .4rem rgba(255, 240, 180, .9)); }
  to { opacity: .4; filter: none; }
}
.brand {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.9rem;
  font-weight: 700;
  color: #fff8e6;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 0 1.2rem rgba(227, 179, 65, .45);
}
html[lang=fa] .brand { font-family: inherit; }
.event { margin: .1rem 0 0; color: var(--gold); font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.event:empty { display: none; }

main { position: relative; z-index: 1; max-width: 36rem; margin: 0 auto; padding: 0 1rem 2rem; }

/* ---------- cards ---------- */
.card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-radius: 1.2rem;
  padding: 2rem 1.25rem 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 .6rem 1.8rem rgba(0, 0, 0, .35);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: .7rem;
  background: repeating-linear-gradient(-45deg, var(--red) 0 .7rem, #fff .7rem 1.4rem);
}
h1, h2 { font-family: Georgia, "Times New Roman", serif; line-height: 1.25; margin: 0 0 .5rem; overflow-wrap: anywhere; }
html[lang=fa] h1, html[lang=fa] h2 { font-family: inherit; line-height: 1.5; }
h1 { font-size: 1.7rem; color: var(--green-deep); }
h2 { font-size: 1.3rem; color: var(--green-deep); margin-top: 1.25rem; }
h2:first-child { margin-top: 0; }
p { margin: 0 0 1rem; }
.hint { color: var(--muted); }
.error { color: var(--red-deep); font-weight: 600; margin: .5rem 0 0; }
.error:empty { display: none; }
.outside { color: var(--snow); text-align: center; margin: 1.25rem 0 0; }
.outside .linklike { color: #fff; }
.fine { font-size: .9rem; }
code { display: block; direction: ltr; text-align: left; background: #f1e8d8; border-radius: .5rem; padding: .6rem .8rem; overflow-wrap: anywhere; }

label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=password], textarea, select {
  display: block;
  width: 100%;
  min-height: 3.2rem;
  padding: .7rem .85rem;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 2px solid var(--field);
  border-radius: .8rem;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--green); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2rem;
  padding: .6rem 1.2rem;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 .25rem 0 var(--red-deep); }
.btn.primary:hover { background: #a91f25; }
.btn.primary:active { transform: translateY(.2rem); box-shadow: 0 .05rem 0 var(--red-deep); }
.btn.secondary { background: #fff; color: var(--green-deep); border-color: var(--green); }
.btn.secondary:hover { background: #eaf5ee; }
.btn.big { width: 100%; min-height: 4rem; font-size: 1.25rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .linklike:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.linklike {
  display: inline-block;
  padding: .6rem .3rem;
  font: inherit;
  color: var(--green-deep);
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}
.linklike.on { font-weight: 700; text-decoration: none; }
.linklike.danger { color: var(--red-deep); }
.langs .linklike { margin: 0 .3rem; }

.warn { background: #fdf3d6; border-inline-start: .3rem solid var(--gold); border-radius: .6rem; padding: .75rem .9rem; }

/* ---------- personal page ---------- */
.reveal { text-align: center; padding-bottom: 1.5rem; }
.reveal h1 { font-size: 2rem; margin-bottom: .75rem; }
.gift { display: block; width: 9rem; height: 9rem; margin: 0 auto .75rem; animation: wiggle 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wiggle {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-6deg); }
  80% { transform: rotate(6deg); }
  90% { transform: rotate(-3deg); }
}
.ask { font-size: 1.2rem; }
.lead { font-size: 1.25rem; margin-bottom: .5rem; }
.tag {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: .25rem 0 1.5rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border: 3px dashed var(--gold-deep);
  border-radius: 1rem;
  transform: rotate(-2deg);
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1);
}
.tag::before, .tag::after { position: absolute; top: -.9rem; font-size: 1.5rem; }
.tag::before { content: "✨"; left: -.7rem; }
.tag::after { content: "⭐"; right: -.7rem; }
.target {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 2.8rem;
  font-size: clamp(2.3rem, 11vw, 3.8rem);
  line-height: 1.15;
  color: var(--red);
  overflow-wrap: anywhere;
}
html[lang=fa] .target { font-family: inherit; line-height: 1.5; }
@keyframes pop {
  from { opacity: 0; transform: scale(.6) rotate(-8deg); }
  to { opacity: 1; transform: rotate(-2deg); }
}
.note { text-align: start; margin-bottom: 1rem; }
.note p { margin: .25rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.confetti { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -2rem; animation: shower 2s ease-in forwards; }
@keyframes shower {
  from { transform: translateY(0) rotate(0); opacity: 1; }
  to { transform: translateY(32rem) rotate(300deg); opacity: 0; }
}

/* ---------- admin: events ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1rem; }
.bar .linklike { color: #fff; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .75rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; }
.events .nm { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.events .meta { color: var(--muted); font-size: .95rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 3rem;
  margin: 0;
  padding: .4rem 1rem;
  background: #fff;
  border: 2px solid var(--field);
  border-radius: 999px;
  cursor: pointer;
}
.chip.on { background: #eaf5ee; border-color: var(--green); }
.chip input, .sent input { width: 1.4rem; height: 1.4rem; margin: 0; accent-color: var(--green); }
.langblock { border-top: 1px dashed var(--line); padding-top: 1rem; }

.add-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.people { list-style: none; margin: 1rem 0 .5rem; padding: 0; border-top: 1px solid var(--line); }
.people:empty { display: none; }
.people li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.people .nm { font-size: 1.15rem; overflow-wrap: anywhere; }
.people select, .row-head select { width: auto; min-height: 2.8rem; padding: .3rem .6rem; }
.icon-btn { width: 3rem; height: 3rem; font-size: 1.6rem; line-height: 1; color: var(--muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: #f1e8d8; color: var(--red-deep); }
.count { color: var(--muted); margin: 0; }
.savestate { min-height: 1.5rem; margin: .5rem 0 0; color: var(--muted); font-size: .9rem; }
.savestate.bad { color: var(--red-deep); font-weight: 600; }

/* ---------- admin: links ---------- */
.progress { font-weight: 700; color: var(--green-deep); margin: 0; }
.links { list-style: none; margin: 1rem 0 0; padding: 0; }
.links li { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: .9rem; margin-bottom: .75rem; }
.links li.is-sent { background: #f0f8f2; border-color: #bcd6c5; }
.row-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; }
.row-head .nm { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.sent { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .4rem 0; font-weight: 600; cursor: pointer; }
.badge { display: inline-block; margin-top: .2rem; font-size: .9rem; color: var(--muted); }
.badge.yes { color: var(--green); font-weight: 600; }
.row-actions { display: grid; grid-template-columns: 1fr; gap: .6rem; margin-top: .7rem; }
.row-actions.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 26rem) { .row-actions.two { grid-template-columns: 1fr; } }
.row-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
.row-foot .linklike { font-size: .9rem; }
.row-pair { margin: .6rem 0; padding: .6rem .75rem; background: #fdf3d6; border-radius: .6rem; }
.row-pair label { display: block; margin-bottom: .35rem; font-weight: 600; }
.pairs-toggle { margin: 1rem 0; }
.pairs-toggle .hint { margin-top: .6rem; }
.after { text-align: center; margin-top: 1rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .gift, .tag, .lights::before, .lights::after { animation: none; }
}
