:root {
  --ink: #2a1540;
  --cream: #fff8ec;
  --gold: #f2b632;
  --pink: #ff5d8f;
  --green: #3f8f3a;
  --skin: #d9a88a;
  --skin-dark: #b98468;
  --hair1: #4b3027;
  --hair2: #744a38;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(circle at 30% 20%, #4a2a6e, #1d0f2e 70%);
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

/* ── stage: fixed 540×960 design, scaled to fit ─────────────────────── */
#viewport { position: fixed; inset: 0; overflow: hidden; }
#stage {
  position: absolute; left: 50%; top: 50%; width: 540px; height: 960px;
  transform: translate(-50%, -50%); transform-origin: center center; overflow: hidden;
  background: #fff; border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
@media (max-aspect-ratio: 9/16), (max-width: 600px) { #stage { border-radius: 0; box-shadow: none; } }
#scene { position: absolute; inset: 0; }
#stage.paused *, #stage.paused *::before, #stage.paused *::after { animation-play-state: paused !important; }

/* ── caption / subtitles / controls ─────────────────────────────────── */
#caption {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 22px;
  background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 999px;
  white-space: nowrap; z-index: 20; opacity: 0; transition: opacity .4s;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
}
#caption.show { opacity: 1; animation: pop-in .5s cubic-bezier(.2,1.6,.4,1); }
#caption b { color: var(--gold); }
#subtitle {
  position: absolute; left: 18px; right: 18px; bottom: 22px; min-height: 150px;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 26px;
  padding: 16px 20px 18px; z-index: 20;
  font-family: "Fredoka", sans-serif; font-weight: 500; font-size: 25px; line-height: 1.28;
  box-shadow: 0 6px 0 var(--ink); opacity: 0; transform: translateY(20px);
  transition: opacity .35s, transform .35s;
}
#subtitle.show { opacity: 1; transform: none; }
#subtitle::before {
  content: attr(data-label); position: absolute; top: -18px; left: 22px;
  background: var(--pink); color: #fff; font-size: 17px; font-weight: 700;
  padding: 2px 12px; border-radius: 999px; border: 3px solid var(--ink);
}
#subtitle .name { color: var(--pink); font-weight: 700; }
#controls { position: absolute; top: 72px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
#controls button {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink);
  background: rgba(255,255,255,.92); font-size: 18px; line-height: 1; padding: 0;
  box-shadow: 0 3px 0 var(--ink);
}
#controls button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

#wipe {
  position: absolute; inset: 0; z-index: 40; pointer-events: none;
  background: var(--ink); clip-path: circle(0% at 50% 45%);
}
#wipe.close { transition: clip-path .45s ease-in; clip-path: circle(80% at 50% 45%); }
#wipe.open { transition: clip-path .5s ease-out; clip-path: circle(0% at 50% 45%); }

/* ── Negar (bobble-head puppet) ──────────────────────────────────────── */
.negar {
  position: absolute; width: 240px; height: 540px;
  transform-origin: 50% 100%;
  transition: left .9s cubic-bezier(.5,0,.3,1), top .9s cubic-bezier(.5,0,.3,1), transform .9s;
  z-index: 5;
  --arL: 12deg; --arR: -12deg;
}
.negar .backhair { position: absolute; left: 0; top: 0; width: 240px; height: 540px; overflow: visible; transform-origin: 133px 160px; transition: transform .12s; }   /* pivot where the locks hang from the head; moved in app.js */
.negar .body { position: absolute; left: 0; top: 200px; width: 240px; height: 340px; overflow: visible; }
.negar .head {
  position: absolute; left: 20px; top: -35px; width: 190px; height: 288px;   /* face frames 520x788 */
  transform-origin: 113px 261px; transition: transform .12s;
}
.negar .face {
  position: absolute; inset: 0;
  background: var(--face-img, url(assets/negar-face.webp)) 0 0 / 600% 200% no-repeat;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.18));
}
.negar .laurel { position: absolute; left: -12px; top: 5px; width: 214px; height: 150px; overflow: visible; opacity: 0; transform: translateY(-340px) rotate(-25deg); }
.negar.crowned .laurel { opacity: 1; transform: none; transition: transform 1s cubic-bezier(.3,1.5,.5,1), opacity .2s; }
.negar .armL { transform: rotate(var(--arL)); transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.negar .armR { transform: rotate(var(--arR)); transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.negar .propR { transform: rotate(calc(-1 * var(--arR))); transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.negar .propL { transform: rotate(calc(-1 * var(--arL))); transition: transform .45s cubic-bezier(.3,1.4,.5,1); }
.negar .prop { display: none; }
.negar[data-prop-r="pointer"] .p-pointer,
.negar[data-prop-r="diploma"] .p-diploma,
.negar[data-prop-r="fork"] .p-fork,
.negar[data-prop-r="glass"] .p-glass,
.negar[data-prop-l="bottle"] .p-bottle { display: inline; }
.negar[data-outfit="party"] .o-smart { display: none; }
.negar:not([data-outfit="party"]) .o-party { display: none; }
.negar.wave { --arR: -150deg; }
.negar.wave .armR { animation: wave .55s ease-in-out infinite alternate; }
.negar.point { --arR: -96deg; }
.negar.cheer { --arL: 155deg; --arR: -155deg; }
.negar.cheer .armL, .negar.cheer .armR { animation: cheer .4s ease-in-out infinite alternate; }
.negar.hold { --arR: -58deg; }
/* eating: a separate hand + fork drawn in front of the face; the normal right arm is hidden */
.negar .eat-arm { position: absolute; left: 0; top: 0; width: 240px; height: 540px; overflow: visible; display: none; pointer-events: none; }
.negar.eat .eat-arm { display: block; }
.negar .eat-arm { clip-path: inset(-120px -120px 80px -120px); }   /* hide the arm below the table edge while the hand is down */
.negar.eat .armR { visibility: hidden; }
.negar .eat-hand { transform-origin: 158px 250px; animation: forkeat 2.4s ease-in-out infinite; }
@keyframes forkeat {
  0%, 100% { transform: translate(6px, 150px) rotate(10deg); }   /* down by the pizza, fully behind the table edge */
  18%      { transform: translate(4px, 138px) rotate(8deg); }    /* pick up… */
  46%, 64% { transform: translate(0, 0) rotate(-4deg); }         /* …up to the mouth, hold */
  72%      { transform: translate(1px, 6px) rotate(-2deg); }
}
.negar.party { --arL: 140deg; --arR: -70deg; }
.negar.dance { animation: dance .5s ease-in-out infinite alternate; }
.negar.bounce { animation: bounce .45s ease-in-out infinite alternate; }

@keyframes wave { from { transform: rotate(-165deg); } to { transform: rotate(-130deg); } }
@keyframes cheer { from { transform: rotate(var(--r, 0deg)) translateY(0); } to { transform: rotate(var(--r, 0deg)) translateY(-6px); } }
.negar.cheer .armL { --r: 155deg; }
.negar.cheer .armR { --r: -155deg; }
@keyframes dance { from { transform: var(--base, none) rotate(-4deg) translateY(0); } to { transform: var(--base, none) rotate(4deg) translateY(-14px); } }
@keyframes bounce { from { transform: var(--base, none) translateY(0); } to { transform: var(--base, none) translateY(-10px); } }

/* ── generic scene bits ──────────────────────────────────────────────── */
.layer { position: absolute; inset: 0; }
.abs { position: absolute; }
svg.bg { position: absolute; inset: 0; width: 540px; height: 960px; }
.bubble {
  position: absolute; z-index: 15; max-width: 250px;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px;
  padding: 8px 12px; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 18px; line-height: 1.2;
  box-shadow: 0 4px 0 var(--ink); opacity: 0; transform: scale(.3); transform-origin: var(--tail-x, 20%) 100%;
}
.bubble::after {
  content: ""; position: absolute; bottom: -14px; left: var(--tail-x, 20%);
  border: 8px solid transparent; border-top: 12px solid var(--ink); transform: translateX(-50%);
}
.bubble.show { opacity: 1; transform: none; transition: transform .45s cubic-bezier(.2,1.6,.4,1), opacity .2s; }
.bubble.hide { opacity: 0; transform: scale(.6); transition: all .25s; }
@keyframes pop-in { from { transform: translateX(-50%) scale(.3); } to { transform: translateX(-50%) scale(1); } }
@keyframes float-up { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(-260px) rotate(30deg); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes blinky { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

.confetti { position: absolute; top: -20px; width: 10px; height: 16px; z-index: 16; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(1010px) rotate(720deg); } }

.big-stamp {
  position: absolute; z-index: 18; left: 50%; top: 140px; transform: translateX(-50%) rotate(-8deg) scale(0);
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 56px; color: #fff;
  background: var(--pink); border: 5px solid var(--ink); border-radius: 18px; padding: 4px 22px;
  box-shadow: 0 7px 0 var(--ink); white-space: nowrap;
}
.big-stamp.show { transform: translateX(-50%) rotate(-8deg) scale(1); transition: transform .5s cubic-bezier(.2,1.8,.4,1); }

/* intro */
.sunburst {
  position: absolute; left: 50%; top: 42%; width: 1500px; height: 1500px; margin: -750px 0 0 -750px;
  background: repeating-conic-gradient(from 0deg, #ffd35c 0deg 10deg, #ffe58f 10deg 20deg);
  animation: spin 40s linear infinite; opacity: .9;
}
.invite-banner {
  position: absolute; top: 76px; left: 50%; transform: translateX(-50%) rotate(-3deg);
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 44px; color: #fff; text-align: center; line-height: 1.05;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); white-space: nowrap;
}
.invite-banner small { display: block; font-size: 26px; color: var(--pink); -webkit-text-stroke: 1.5px var(--ink); }

/* defence */
.chart-line { stroke-dasharray: 1; stroke-dashoffset: 1; } /* pathLength="1" */
.go .chart-line { animation: draw 5s ease-in-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.zzz { font-family: "Fredoka"; font-weight: 700; fill: #6a5a9a; animation: float-up 2.2s ease-out infinite; }
.prof-rise { transition: transform 1s cubic-bezier(.4,1.3,.5,1); }

/* photo */
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 17; pointer-events: none; }
.flash.go { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }
.polaroid {
  position: absolute; z-index: 16; left: 26px; top: 88px; width: 488px; height: 640px; pointer-events: none;
  border: 18px solid #fff; border-bottom-width: 84px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  opacity: 0; transform: rotate(0) scale(1.15);
}
.polaroid.show { opacity: 1; transform: rotate(-3deg) scale(1); transition: all .6s cubic-bezier(.2,1.4,.4,1); }
.polaroid .cap { position: absolute; bottom: -70px; left: 0; right: 0; text-align: center; font-family: "Caveat", cursive; font-size: 40px; font-weight: 700; color: var(--ink); }
.friend { position: absolute; z-index: 4; transform-origin: 50% 100%; }
.friend.hop { animation: bounce .4s ease-in-out infinite alternate; }

/* dinner */
.steam { animation: float-up 2.5s ease-out infinite; }
.vespa { animation: vespa 7s linear infinite; }
@keyframes vespa { from { transform: translateX(-200px); } to { transform: translateX(760px); } }
.string-light { animation: blinky 1.4s ease-in-out infinite; }

/* party */
.beam { transform-origin: 50% 0; mix-blend-mode: screen; animation: sway 2.4s ease-in-out infinite alternate; }
.discoball { animation: spin 4s linear infinite; transform-origin: 270px 120px; }
.tile { animation: blinky 1s steps(2) infinite; }
.foam { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fffbe0; border: 2px solid #e8d890; z-index: 16; animation: foam 1.2s ease-out forwards; }
@keyframes foam { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.cork { position: absolute; z-index: 16; width: 18px; height: 22px; background: #c49a5a; border-radius: 6px 6px 3px 3px; border: 2px solid var(--ink); animation: cork 1.4s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes cork { to { transform: translate(120px, -520px) rotate(900deg); } }

/* finale */
.postcard {
  position: absolute; left: 22px; right: 22px; top: 86px; bottom: 196px;
  background: var(--cream); border-radius: 18px; border: 4px solid var(--ink); box-shadow: 0 8px 0 var(--ink);
  padding: 22px 22px 18px; overflow: hidden;
  background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgba(255,93,143,.05) 14px 28px);
}
.postcard::before {
  content: ""; position: absolute; inset: 8px; border-radius: 12px; pointer-events: none;
  border: 6px solid transparent;
  border-image: repeating-linear-gradient(45deg, #e63b4f 0 12px, #fff 12px 24px, #2b6fd6 24px 36px, #fff 36px 48px) 6;
}
.postcard h2 { font-family: "Fredoka"; font-size: 34px; margin: 118px 0 4px; line-height: 1.05; }
.postcard h2 .name { color: var(--pink); }
.postcard .sub { font-family: "Caveat"; font-size: 27px; line-height: 1.05; margin: 0 110px 12px 0; color: #6a4b7c; }
.postcard .row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; padding: 7px 0; border-top: 2px dashed rgba(42,21,64,.2); }
.postcard .row .ic { font-size: 30px; line-height: 1; }
.postcard .row b { font-family: "Fredoka"; font-size: 21px; display: block; }
.postcard .row span { font-size: 15px; line-height: 1.25; color: #5a4a66; }
.postcard .row a { color: #2b6fd6; font-weight: 800; font-size: 15px; }
.stamp {
  position: absolute; right: 22px; top: 22px; width: 104px; height: 124px; background: #fff; padding: 6px;
  transform: rotate(6deg); z-index: 2;
  -webkit-mask: radial-gradient(circle 4px at 6px 6px, transparent 96%, #000) -6px -6px / 12px 12px, linear-gradient(#000 0 0) content-box;
          mask: radial-gradient(circle 4px at 6px 6px, transparent 96%, #000) -6px -6px / 12px 12px, linear-gradient(#000 0 0) content-box;
}
.stamp .in { width: 100%; height: 100%; background: linear-gradient(#ffd35c, #ff9a5c); display: grid; place-items: end center; overflow: hidden; position: relative; }
.stamp .in i { position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-style: normal; font-family: "Fredoka"; font-weight: 700; font-size: 11px; color: var(--ink); }
.stamp .mini { width: 86px; height: 130px; background: var(--face-img, url(assets/negar-face.webp)) 0 0 / 600% 200% no-repeat; margin-bottom: -18px; }
.postmark {
  position: absolute; right: 104px; top: 16px; width: 88px; height: 88px; border-radius: 50%; z-index: 3;
  border: 3px solid rgba(42,21,64,.55); color: rgba(42,21,64,.6); display: grid; place-items: center; text-align: center;
  font-family: "Fredoka"; font-weight: 700; font-size: 11px; line-height: 1.1; transform: rotate(-14deg);
}
.btns { position: absolute; left: 22px; right: 22px; bottom: 26px; display: flex; gap: 10px; z-index: 22; flex-wrap: wrap; justify-content: center; }
.btn {
  flex: 1 1 140px; border: 3px solid var(--ink); border-radius: 16px; padding: 12px 10px; font-family: "Fredoka"; font-weight: 700; font-size: 18px;
  background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 var(--ink); text-decoration: none; text-align: center;
}
.btn.pink { background: var(--pink); color: #fff; }
.btn.ghost { background: #fff; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.finale-head { position: absolute; z-index: 21; }

/* ── envelope intro ──────────────────────────────────────────────────── */
#envelope-screen {
  position: absolute; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #ffe3ec, #ffc0d3 55%, #f78fb3);
  transition: opacity .6s, visibility .6s;
}
#envelope-screen.gone { opacity: 0; visibility: hidden; }
.env-wrap { position: relative; width: 440px; height: 600px; margin-bottom: 110px; }
.env-title { position: absolute; top: 0; left: 0; right: 0; text-align: center; font-family: "Fredoka"; font-weight: 700; font-size: 34px; color: var(--ink); line-height: 1.1; }
.env-title small { display: block; font-family: "Caveat"; font-size: 30px; color: #8a2b52; }
.envelope {
  position: absolute; left: 20px; top: 170px; width: 400px; height: 260px;
  background: #fdf1dc; border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 10px 0 var(--ink);
  animation: wiggle 2.4s ease-in-out infinite; cursor: pointer;
}
@keyframes wiggle { 0%,80%,100% { transform: rotate(0); } 85% { transform: rotate(-3deg); } 90% { transform: rotate(3deg); } 95% { transform: rotate(-2deg); } }
.envelope .flap {
  position: absolute; left: -4px; top: -4px; width: 408px; height: 150px; transform-origin: 50% 0; z-index: 3; overflow: visible;
}
.envelope .seal {
  position: absolute; left: 50%; top: 118px; width: 64px; height: 64px; margin-left: -32px; z-index: 4;
  border-radius: 50%; background: #c8243f; border: 4px solid var(--ink); display: grid; place-items: center; font-size: 30px;
}
.envelope .to { position: absolute; left: 34px; bottom: 26px; font-family: "Caveat"; font-size: 36px; font-weight: 700; color: var(--ink); z-index: 2; }
.envelope .to .name { color: #c8243f; }
.envelope .estamp { position: absolute; right: 22px; bottom: 22px; width: 70px; height: 84px; z-index: 2; transform: rotate(5deg); }
.envelope .estamp .stamp { position: static; width: 70px; height: 84px; padding: 4px; transform: none; }
.envelope .estamp .stamp .mini { width: 60px; height: 91px; margin-bottom: -14px; }
.envelope .estamp .stamp .in i { font-size: 8px; }
.envelope.opening { animation: none; }
.envelope.opening .flap { transform: rotateX(180deg); transition: transform .5s; }
.envelope.opening .seal { opacity: 0; transition: opacity .2s; }
.open-btn {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%);
  font-family: "Fredoka"; font-weight: 700; font-size: 28px; padding: 14px 34px;
  background: var(--pink); color: #fff; border: 4px solid var(--ink); border-radius: 999px; box-shadow: 0 7px 0 var(--ink);
  animation: throb 1s ease-in-out infinite alternate; white-space: nowrap;
}
.open-btn[disabled] { background: #bbb; animation: none; }
@keyframes throb { to { transform: translateX(-50%) scale(1.07); } }
/* "this card has sound" badge under the open button */
.sound-badge {
  position: absolute; left: 50%; bottom: -48px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 6px 0 var(--ink); padding: 10px 24px 10px 18px; white-space: nowrap;
}
.sound-badge .spk { font-size: 40px; line-height: 1; animation: spk 1s ease-in-out infinite alternate; }
@keyframes spk { to { transform: scale(1.18) rotate(-6deg); } }
.sound-badge .eq { display: flex; align-items: flex-end; gap: 4px; height: 34px; }
.sound-badge .eq i { width: 6px; height: 100%; border-radius: 3px; background: var(--pink); transform-origin: bottom; animation: eq .9s ease-in-out infinite alternate; }
.sound-badge .eq i:nth-child(2) { animation-delay: -.3s; background: #a45dff; }
.sound-badge .eq i:nth-child(3) { animation-delay: -.6s; background: #2b6fd6; }
.sound-badge .eq i:nth-child(4) { animation-delay: -.15s; background: #3fd1a0; }
@keyframes eq { 0% { transform: scaleY(.25); } 100% { transform: scaleY(1); } }
.sound-badge .txt { display: flex; flex-direction: column; font-size: 17px; font-weight: 700; color: #7a2a4a; line-height: 1.3; }
.sound-badge .txt b { font-family: "Fredoka"; font-size: 25px; color: var(--ink); }

/* ── link maker (?make) ──────────────────────────────────────────────── */
#maker { position: fixed; inset: 0; z-index: 100; overflow: auto; background: #1d0f2e; color: #fff; padding: 24px 16px 60px; }
#maker .box { max-width: 640px; margin: 0 auto; background: var(--cream); color: var(--ink); border-radius: 20px; padding: 22px; border: 4px solid var(--ink); }
#maker h1 { font-family: "Fredoka"; margin: 0 0 6px; }
#maker textarea { width: 100%; min-height: 110px; font: inherit; font-size: 17px; padding: 10px; border-radius: 12px; border: 3px solid var(--ink); }
#maker .link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-top: 2px dashed rgba(42,21,64,.2); }
#maker .link code { flex: 1 1 100%; word-break: break-all; font-size: 13px; background: #fff; padding: 6px 8px; border-radius: 8px; }
#maker .link b { flex: 1; font-family: "Fredoka"; font-size: 19px; }
#maker .btn { flex: 0 0 auto; font-size: 15px; padding: 8px 12px; }

@media (prefers-reduced-motion: reduce) {
  .sunburst, .envelope, .open-btn, .discoball, .beam, .vespa, .sound-badge .spk, .sound-badge .eq i { animation: none !important; }
}

/* ── language toggle + Persian / right-to-left ───────────────────────── */
.lang-toggle {
  position: absolute; top: -70px; right: 0; z-index: 5;
  font-family: "Vazirmatn", "Fredoka", sans-serif; font-weight: 800; font-size: 16px; text-decoration: none;
  color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; box-shadow: 0 3px 0 var(--ink);
}
html[lang="fa"] .lang-toggle { right: auto; left: 0; }
/* Vazirmatn everywhere in Persian (overrides the SVG font-family attributes too) */
html[lang="fa"] #stage, html[lang="fa"] #stage * { font-family: "Vazirmatn", "Fredoka", sans-serif !important; }
html[lang="fa"] #stage .lang-toggle { font-family: "Fredoka", sans-serif !important; }
html[lang="fa"] #subtitle { font-size: 23px; line-height: 1.6; font-weight: 600; padding-top: 18px; }
html[lang="fa"] #subtitle::before { left: auto; right: 22px; }
html[lang="fa"] #caption { font-size: 20px; font-weight: 800; }
html[lang="fa"] .bubble { font-size: 17px; line-height: 1.5; font-weight: 700; }
html[lang="fa"] .invite-banner { font-size: 64px; font-weight: 900; -webkit-text-stroke: 2.5px var(--ink); line-height: 1.25; }
html[lang="fa"] .invite-banner small { font-size: 26px; font-weight: 900; }
html[lang="fa"] .big-stamp { font-size: 50px; font-weight: 900; }
html[lang="fa"] .env-title { font-size: 34px; font-weight: 900; line-height: 1.5; }
html[lang="fa"] .env-title small { font-size: 22px; font-weight: 600; }
html[lang="fa"] .envelope .to { left: auto; right: 34px; font-size: 28px; font-weight: 800; }
html[lang="fa"] .envelope .estamp { right: auto; left: 22px; transform: rotate(-5deg); }
html[lang="fa"] .open-btn { font-size: 26px; font-weight: 900; }
html[lang="fa"] .sound-badge { padding: 10px 18px 10px 24px; }
html[lang="fa"] .sound-badge .txt { font-family: "Vazirmatn"; font-size: 16px; }
html[lang="fa"] .sound-badge .txt b { font-family: "Vazirmatn"; font-size: 23px; font-weight: 900; }
html[lang="fa"] .polaroid .cap { font-size: 30px; font-weight: 800; bottom: -66px; }
html[lang="fa"] .postcard h2 { font-size: 27px; font-weight: 900; line-height: 1.2; }
html[lang="fa"] .postcard .sub { font-size: 17px; font-weight: 600; margin: 2px 0 6px 110px; line-height: 1.45; }
html[lang="fa"] .postcard .row { padding: 4px 0; }
html[lang="fa"] .postcard .row b { font-size: 18px; font-weight: 800; line-height: 1.4; }
html[lang="fa"] .postcard .row span { font-size: 14px; }
html[lang="fa"] .postcard .row a { font-size: 13px; }
html[lang="fa"] .stamp { right: auto; left: 22px; transform: rotate(-6deg); }
html[lang="fa"] .postmark { right: auto; left: 104px; transform: rotate(12deg); }
html[lang="fa"] .btn { font-weight: 800; font-size: 17px; }
html[lang="fa"] #stage svg { direction: ltr; } /* keep SVG text-anchor physical; Persian strings still shape RTL */

/* party: two dancing wolves (see wolves in app.js) */
canvas.wolf { position: absolute; top: 385px; width: 300px; height: 395px; z-index: 4; pointer-events: none; }

/* final scene: Negar's line as a speech bubble beside her head (keeps the bottom free for buttons) */
#subtitle.beside-head {
  top: 10px; bottom: auto; left: 196px; right: 14px; min-height: 0;
  font-size: 16.5px; line-height: 1.32; padding: 10px 14px; border-radius: 20px; box-shadow: 0 4px 0 var(--ink);
}
#subtitle.beside-head::before { display: none; }
#subtitle.beside-head::after {
  content: ""; position: absolute; left: -16px; top: 58px;
  border: 9px solid transparent; border-right: 14px solid var(--ink);
}
html[lang="fa"] #subtitle.beside-head { font-size: 15.5px; line-height: 1.55; padding: 8px 14px; }
/* bigger, calmer postcard now that it has the room */
.postcard .row { padding: 11px 0; }
.postcard .row b { font-size: 23px; }
.postcard .row span { font-size: 17px; }
.postcard .row a { font-size: 16px; }
html[lang="fa"] .postcard .row { padding: 10px 0; }
html[lang="fa"] .postcard .row b { font-size: 20px; }
html[lang="fa"] .postcard .row span { font-size: 15.5px; }
html[lang="fa"] .postcard .row a { font-size: 14px; }
.btns .btn { padding: 14px 10px; font-size: 19px; }

/* ── Next / Back: pills on the bottom edge of the text box ─────────────── */
#nav {
  position: absolute; left: 34px; right: 34px; bottom: 6px; z-index: 25;
  display: flex; justify-content: space-between; pointer-events: none;
  direction: ltr;   /* Back always left, Next always right — in both languages */
}
.nav-btn {
  pointer-events: auto; font-family: "Fredoka", "Vazirmatn", sans-serif; font-weight: 700; font-size: 19px;
  padding: 7px 20px; border-radius: 999px; border: 3px solid var(--ink);
  background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.nav-btn.next { background: var(--pink); color: #fff; }
.nav-btn.next.ready { animation: nudge 1.1s ease-in-out infinite; }
.nav-btn:disabled { visibility: hidden; }
.nav-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.nav-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .nav-btn.next.ready { animation: none; } }
/* leave room for the pills under the text */
#subtitle { bottom: 30px; padding-bottom: 26px; }
