@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --primary: #ec6f9a;
  --bg: #fff4f7;
  --card: #ffffff;
  --text: #5a2a3d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; }

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--primary) 12%, transparent) 0, transparent 40%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--primary) 10%, transparent) 0, transparent 45%);
  color: var(--text);
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
}

#stage { width: 100%; max-width: 440px; position: relative; z-index: 2; }

.card {
  background: var(--card);
  border-radius: 28px;
  padding: 34px 26px 28px;
  text-align: center;
  box-shadow: 0 20px 60px -20px color-mix(in srgb, var(--primary) 45%, transparent), 0 2px 8px rgba(0,0,0,.04);
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .45s ease, transform .45s cubic-bezier(.2,.9,.3,1.2);
}
.card.show { opacity: 1; transform: none; }
.card.hide { opacity: 0; transform: translateY(-14px) scale(.97); transition-duration: .3s; }

.media {
  width: 130px; height: 130px; margin: 0 auto 18px;
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,.35);
  background: color-mix(in srgb, var(--primary) 12%, white);
}
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.round { border-radius: 50%; }

.emoji-big {
  font-size: 76px; line-height: 1; margin: 0 auto 16px;
  display: inline-block; animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }

h1 { font-size: 22px; font-weight: 800; margin: 0 0 8px; line-height: 1.7; }
p.sub { margin: 0 0 6px; opacity: .75; font-size: 14.5px; line-height: 1.9; white-space: pre-line; }

.actions { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 22px; flex-wrap: wrap; min-height: 52px; }

.btn {
  font: inherit; font-weight: 700; font-size: 15px;
  border: 0; border-radius: 999px; padding: 12px 28px; cursor: pointer;
  background: var(--primary); color: #fff;
  box-shadow: 0 8px 20px -8px var(--primary);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s, font-size .25s, padding .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.ghost {
  background: color-mix(in srgb, var(--primary) 14%, white);
  color: var(--primary); box-shadow: none;
}
.btn.no { transition: left .25s ease, top .25s ease, transform .2s, font-size .2s, padding .2s; z-index: 50; white-space: nowrap; }
.btn.no.flying { position: fixed; }

.field { text-align: right; margin-top: 18px; }
.field > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; opacity: .8; }

/* Jalali calendar */
.cal { border: 1.5px solid color-mix(in srgb, var(--primary) 20%, white); border-radius: 18px; padding: 10px; user-select: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 15px; }
.cal-nav { background: none; border: 0; font: inherit; font-size: 20px; color: var(--primary); cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.cal-nav:hover { background: color-mix(in srgb, var(--primary) 12%, white); }
.cal-nav:disabled { opacity: .25; cursor: default; background: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wd { font-size: 11px; opacity: .55; padding: 4px 0; text-align: center; }
.cal-grid button {
  font: inherit; font-size: 14px; aspect-ratio: 1; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer;
}
.cal-grid button:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 12%, white); }
.cal-grid button:disabled { opacity: .25; cursor: default; }
.cal-grid button.today { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 50%, white); }
.cal-grid button.sel { background: var(--primary); color: #fff; font-weight: 700; }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  font: inherit; text-align: right; padding: 12px 16px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--primary) 20%, white); background: #fff; color: var(--text);
  transition: all .2s;
}
.opt:hover { border-color: var(--primary); }
.opt.sel { background: color-mix(in srgb, var(--primary) 12%, white); border-color: var(--primary); font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.tile {
  font: inherit; color: var(--text); cursor: pointer; padding: 14px 6px 10px; border-radius: 18px;
  border: 1.5px solid color-mix(in srgb, var(--primary) 15%, white); background: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: all .2s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.tile.sel { background: color-mix(in srgb, var(--primary) 14%, white); border-color: var(--primary); box-shadow: 0 6px 16px -8px var(--primary); }
.tile .te { font-size: 34px; line-height: 1.1; }
.tile img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; }
.tile span { font-size: 12.5px; font-weight: 600; }
.tiles.two { grid-template-columns: repeat(2, 1fr); }

textarea.msg {
  width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 15px; color: var(--text);
  border: 1.5px solid color-mix(in srgb, var(--primary) 25%, white); border-radius: 16px; padding: 12px 14px; outline: none; margin-top: 16px;
}
textarea.msg:focus { border-color: var(--primary); }

.summary {
  margin-top: 18px; padding: 14px 16px; border-radius: 16px; text-align: right; font-size: 14px; line-height: 2.1;
  background: color-mix(in srgb, var(--primary) 8%, white);
}
.summary b { color: var(--primary); }
.ps { margin-top: 16px; font-size: 13px; opacity: .6; font-style: italic; line-height: 1.9; white-space: pre-line; }
.hearts { margin-top: 12px; color: var(--primary); letter-spacing: 8px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }

.steps-dots { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.steps-dots i { width: 6px; height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 25%, white); transition: all .3s; }
.steps-dots i.on { width: 20px; background: var(--primary); }

#petals { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#petals span { position: absolute; top: -40px; animation: fall linear forwards; opacity: .85; }
@keyframes fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); }
}

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

#music {
  position: fixed; bottom: 18px; left: 18px; z-index: 70; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--card); box-shadow: 0 6px 18px -6px rgba(0,0,0,.3); font-size: 20px; cursor: pointer;
}
#music.off { opacity: .5; text-decoration: line-through; }
#music.playing { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.err { color: #d33; font-size: 13px; margin-top: 10px; min-height: 1em; }

body.notfound .card { max-width: 380px; }

@media (max-width: 380px) {
  .card { padding: 28px 18px 22px; }
  h1 { font-size: 19px; }
  .tiles { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .emoji-big, .hearts, #music.playing { animation: none; }
}
