:root {
  --shell: #f2fbed;
  --ink: #0a4a3d;
  --ink-soft: rgba(10, 74, 61, .58);
  --leaf: #08a979;
  --leaf-deep: #087e63;
  --water: #3bd6cb;
  --water-soft: #9ceee3;
  --lime: #caf13e;
  --lime-soft: #e8fa8c;
  --paper: #fbfff7;
  --white-glass: rgba(253, 255, 249, .72);
  --line: rgba(8, 169, 121, .18);
  --shadow: 0 24px 70px rgba(8, 126, 99, .15);
  --action-bottom-gap: clamp(48px, 6.4dvh, 56px);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  color-scheme: light;
  background: var(--shell);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--shell);
  font-family: "Xiaolai SC", "Songti SC", serif;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }
button:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }

.app {
  position: relative;
  isolation: isolate;
  width: min(100%, 460px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, var(--shell) 0%, #fafff6 50%, var(--shell) 100%);
  box-shadow: 0 0 70px rgba(8, 126, 99, .08);
}

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(42px);
  opacity: .62;
}

.ambient-lime {
  width: 360px;
  height: 235px;
  left: calc(50% - 380px);
  bottom: -35px;
  border-radius: 63% 37% 56% 44% / 41% 58% 42% 59%;
  background: rgba(202, 241, 62, .46);
  animation: ambientLime 14s ease-in-out infinite alternate;
}

.ambient-water {
  width: 390px;
  height: 280px;
  right: calc(50% - 400px);
  bottom: -85px;
  border-radius: 42% 58% 34% 66% / 62% 39% 61% 38%;
  background: rgba(59, 214, 203, .42);
  animation: ambientWater 16s ease-in-out infinite alternate;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(28px) scale(.99);
  transition: opacity .5s ease, transform .7s cubic-bezier(.2, .76, .2, 1);
}

.screen.is-active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.screen.is-leaving {
  opacity: 0;
  transform: translateX(-28px) scale(.99);
}

.simple-head {
  position: relative;
  z-index: 8;
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  padding: max(19px, env(safe-area-inset-top)) 25px 0;
}

.brand {
  color: rgba(10, 74, 61, .58);
  font-size: 16px;
  letter-spacing: .19em;
}

.birthday-note {
  color: #0b9477;
  font-size: 12px;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .5s ease, transform .6s ease;
}

.birthday-mode .birthday-note {
  opacity: .84;
  transform: translateY(0);
}

.grain-guide {
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 43%;
  color: rgba(8, 169, 121, .035);
  font-size: min(65vw, 275px);
  line-height: 1;
  filter: blur(2px);
  opacity: .72;
  text-shadow: 0 0 22px rgba(59, 214, 203, .18), 0 0 48px rgba(202, 241, 62, .16);
  transform: translate(-50%, -50%) scale(1.02);
  transition: opacity 1.4s ease, filter 1.5s ease, transform 1.5s ease;
}

.intro-screen.is-dispersing-grain .grain-guide {
  filter: blur(16px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.12);
}

.grain-particle-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wind-field {
  position: absolute;
  z-index: 2;
  inset: 86px 18px 116px;
}

.wind-word {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: inline-block;
  white-space: nowrap;
  color: var(--word-color);
  font-size: var(--word-size);
  letter-spacing: .035em;
  transform: rotate(var(--tilt));
  animation: windDrift var(--speed) ease-in-out infinite alternate;
  transition: left 1.15s cubic-bezier(.2, .8, .2, 1), top 1.15s cubic-bezier(.2, .8, .2, 1), color .7s ease, transform 1.1s ease;
}

.intro-screen.is-assembling .wind-word {
  font-size: 10px;
  animation: assembledDrift var(--settle-speed, 4.5s) ease-in-out infinite alternate;
  transform: rotate(0deg) scale(.9);
}

.intro-action {
  position: absolute;
  z-index: 7;
  right: 25px;
  bottom: calc(var(--action-bottom-gap) + env(safe-area-inset-bottom));
  left: 25px;
  transition: opacity .28s ease, transform .42s cubic-bezier(.2, .75, .2, 1);
}

.intro-screen.is-assembling .intro-action {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.98);
}

.glass-button,
.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 999px;
  cursor: pointer;
}

.glass-button {
  width: 100%;
  border: 1px solid rgba(8, 169, 121, .25);
  color: var(--ink);
  background: var(--white-glass);
  box-shadow: 0 14px 38px rgba(8, 126, 99, .1), inset 0 1px rgba(255, 255, 255, .8);
  backdrop-filter: blur(18px) saturate(125%);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.quiet-button,
.library-button,
.refresh-button,
.sheet-close {
  min-height: 40px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.editor-screen {
  isolation: isolate;
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(ellipse at 92% 18%, rgba(59, 214, 203, .14), transparent 38%),
    radial-gradient(ellipse at 7% 82%, rgba(202, 241, 62, .15), transparent 43%),
    linear-gradient(180deg, var(--shell) 0%, rgba(250, 255, 246, .96) 48%, var(--shell) 100%);
}

.editor-atmosphere {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.editor-atmosphere::after {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(8, 169, 121, .11) 0 1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(145deg, transparent 10%, rgba(0, 0, 0, .45) 45%, transparent 82%);
  mask-image: linear-gradient(145deg, transparent 10%, rgba(0, 0, 0, .45) 45%, transparent 82%);
  opacity: .16;
  content: "";
}

.editor-light {
  position: absolute;
  border-radius: 48% 52% 64% 36% / 45% 38% 62% 55%;
  background-size: 165% 165%;
  filter: blur(34px);
  opacity: .48;
  will-change: transform, opacity, filter, border-radius, background-position;
}

.light-one {
  width: 310px;
  height: 230px;
  top: 17%;
  right: -100px;
  background-image: radial-gradient(ellipse at 38% 46%, rgba(255, 255, 255, .34), rgba(59, 214, 203, .52) 20%, rgba(139, 234, 221, .22) 48%, transparent 76%);
  animation: editorLightOne 8.2s cubic-bezier(.45, .05, .25, .98) infinite alternate;
}

.light-two {
  width: 300px;
  height: 220px;
  bottom: 9%;
  left: -118px;
  background-image: radial-gradient(ellipse at 58% 42%, rgba(247, 255, 205, .42), rgba(202, 241, 62, .55) 22%, rgba(181, 237, 87, .2) 50%, transparent 77%);
  animation: editorLightTwo 9.6s cubic-bezier(.35, .02, .3, 1) infinite alternate;
}

.editor-rabbit-watermark {
  position: absolute;
  z-index: 1;
  right: -6%;
  bottom: 22%;
  width: 68%;
  pointer-events: none;
  transform-origin: 68% 72%;
  animation: rabbitBreathe 7s ease-in-out infinite alternate;
}

[data-rabbit-watermark-host] img {
  display: block;
  width: 100%;
  height: auto;
  opacity: .58;
  user-select: none;
}

.poem-editor {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 410px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 30px 24px 22px;
}

.poem-row {
  position: relative;
  display: flex;
  min-height: 59px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  gap: 8px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: center;
  cursor: text;
}

.poem-row::after {
  position: absolute;
  right: 15%;
  bottom: 4px;
  left: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(8, 169, 121, .24) 50%, transparent);
  content: "";
  opacity: 0;
  transition: opacity .25s ease;
}

.poem-row.is-active::after { opacity: 1; }
.poem-token {
  position: relative;
  border: 0;
  min-height: 48px;
  padding: 0 14px;
  color: var(--token-ink, var(--ink));
  background: var(--token-bg, var(--lime));
  clip-path: var(--token-shape);
  font-size: 17px;
  line-height: 1.15;
  letter-spacing: .015em;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transform: rotate(var(--token-turn, 0deg));
  transition: opacity .2s ease, transform .2s ease;
}

.poem-token.is-dragging { z-index: 8; opacity: .42; transform: rotate(0) scale(.96); }
.poem-row.is-drop-target::after { height: 2px; opacity: 1; background: var(--water); }

.poem-placeholder {
  color: rgba(8, 126, 99, .22);
  font-size: 15px;
  letter-spacing: .04em;
}

.word-area {
  position: relative;
  z-index: 3;
  padding: 0 21px;
}

.word-area-head {
  display: flex;
  min-height: 43px;
  align-items: center;
  justify-content: space-between;
}

.library-button,
.refresh-button { padding: 0 5px; }
.refresh-button { border-bottom: 2px solid var(--lime); }

.candidate-tray {
  display: flex;
  min-height: 129px;
  align-content: center;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 11px 9px;
  perspective: 500px;
}

.word-chip {
  position: relative;
  min-width: 72px;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  color: var(--token-ink, var(--ink));
  background: var(--token-bg, var(--lime));
  clip-path: var(--token-shape);
  font-size: 17px;
  cursor: pointer;
  transform: rotate(var(--token-turn, 0deg));
  transition: transform .26s ease, opacity .26s ease;
}

.tone-0 { --token-bg: #caf13e; --token-ink: #0a4a3d; }
.tone-1 { --token-bg: #50ddd0; --token-ink: #075b50; }
.tone-2 { --token-bg: #e7fa83; --token-ink: #557b0c; }
.tone-3 { --token-bg: #08a979; --token-ink: #f8fff5; }
.tone-4 { --token-bg: #a7ebdf; --token-ink: #087164; }
.tone-5 { --token-bg: #b5ed57; --token-ink: #286a30; }

.shape-0 { --token-shape: polygon(4% 8%, 93% 0, 100% 78%, 87% 100%, 3% 92%, 0 25%); }
.shape-1 { --token-shape: polygon(8% 0, 91% 8%, 100% 85%, 70% 100%, 0 88%, 4% 18%); }
.shape-2 { --token-shape: polygon(0 13%, 88% 0, 100% 22%, 94% 95%, 9% 100%, 3% 70%); }
.shape-3 { --token-shape: polygon(3% 22%, 16% 0, 87% 9%, 100% 38%, 93% 100%, 10% 91%); }
.shape-4 { --token-shape: polygon(7% 4%, 97% 0, 92% 89%, 75% 100%, 0 92%, 3% 19%); }
.shape-5 { --token-shape: polygon(0 18%, 11% 2%, 88% 0, 100% 73%, 91% 98%, 4% 91%); }

.turn-0 { --token-turn: -3deg; }
.turn-1 { --token-turn: -1.5deg; }
.turn-2 { --token-turn: 0deg; }
.turn-3 { --token-turn: 1.5deg; }
.turn-4 { --token-turn: 3deg; }

.word-chip:active { transform: translateY(-6px) rotate(0) scale(1.04); }
.word-chip.is-flying { opacity: 0; transform: translateY(-32px) rotate(0) scale(.85); }

.candidate-tray.is-wind-out .word-chip {
  animation: candidateWindOut .55s cubic-bezier(.5, 0, .8, .3) forwards;
  animation-delay: var(--wind-out-delay, 0ms);
}

.candidate-tray.is-wind-in .word-chip {
  animation: candidateWindIn .65s cubic-bezier(.18, .78, .25, 1) both;
  animation-delay: var(--wind-in-delay, 0ms);
}

.editor-action {
  position: sticky;
  z-index: 6;
  bottom: 0;
  margin-top: auto;
  padding: 16px 22px calc(var(--action-bottom-gap) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(242, 251, 237, .91) 24%, rgba(242, 251, 237, .99) 58%);
}

.primary-button {
  width: 100%;
  border: 1px solid rgba(8, 169, 121, .24);
  color: var(--ink);
  background: var(--lime);
  box-shadow: 7px 8px 0 rgba(59, 214, 203, .22);
}

.primary-button:disabled { opacity: .45; cursor: not-allowed; }

.compact-primary {
  width: 100%;
  min-height: 44px;
  padding: 0 20px;
  box-shadow: 5px 6px 0 rgba(59, 214, 203, .2);
}

.library-layer {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: max(28px, env(safe-area-inset-top));
  background: rgba(5, 65, 53, .14);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}

.library-layer.is-open { opacity: 1; pointer-events: auto; }

.library-sheet {
  width: min(100%, 460px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: hidden;
  padding: 21px 18px calc(22px + env(safe-area-inset-bottom));
  border: 1px solid rgba(8, 169, 121, .2);
  border-radius: 31px 31px 0 0;
  background: rgba(252, 255, 248, .96);
  box-shadow: 0 -25px 75px rgba(8, 126, 99, .18);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateY(105%);
  transition: transform .52s cubic-bezier(.2, .8, .2, 1);
}

.library-layer.is-open .library-sheet { transform: translateY(0); }

.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 15px;
}

.library-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.library-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.sheet-close { padding: 0 3px; }

.year-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 15px;
  scrollbar-width: none;
}

.year-tabs::-webkit-scrollbar { display: none; }

.year-tab {
  flex: none;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.year-tab.is-active { border-color: transparent; color: var(--ink); background: var(--lime); }

.year-library {
  max-height: calc(88dvh - 145px);
  overflow-y: auto;
  padding: 2px 2px 35px;
}

.album-section { margin-bottom: 22px; }
.album-title { margin: 0 0 10px; color: var(--ink-soft); font-size: 13px; font-weight: 400; }
.song-section { margin-bottom: 15px; }
.song-title { margin: 0 0 8px; color: var(--ink); font-size: 16px; font-weight: 400; }
.library-words { display: flex; flex-wrap: wrap; gap: 8px; }

.library-word {
  min-height: 39px;
  padding: 0 12px;
  border: 0;
  color: var(--ink);
  background: rgba(59, 214, 203, .17);
  clip-path: polygon(3% 8%, 95% 0, 100% 82%, 91% 100%, 0 92%);
  cursor: pointer;
}

.library-word.is-selected {
  color: #f8fff5;
  background: var(--leaf);
}

.share-screen { background: linear-gradient(180deg, var(--shell) 0%, #f8fff4 48%, var(--shell) 100%); }

.share-card-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 1;
  place-items: center;
  padding: 10px 41px 17px;
}

.share-card {
  position: relative;
  width: min(100%, 290px);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  background:
    radial-gradient(ellipse 92% 42% at 4% 94%, rgba(202, 241, 62, .28), transparent 68%),
    radial-gradient(ellipse 88% 45% at 98% 91%, rgba(59, 214, 203, .26), transparent 70%),
    radial-gradient(ellipse 70% 29% at 91% 4%, rgba(156, 238, 227, .1), transparent 72%),
    #fdfff8;
  box-shadow: var(--shadow);
}

.share-meta {
  position: absolute;
  z-index: 5;
  top: 26px;
  right: 25px;
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.share-mark {
  color: rgba(10, 74, 61, .4);
  letter-spacing: .18em;
}

.share-poem {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  flex-direction: column;
  transform: translateY(-50%);
}

.share-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: var(--share-gap, 26px);
}

.share-token {
  display: inline-grid;
  min-height: var(--share-token-height, 36px);
  place-items: center;
  padding: 0 13px;
  color: var(--token-ink, var(--ink));
  background: var(--token-bg, var(--lime));
  clip-path: var(--token-shape);
  font-size: var(--share-font, 19px);
  line-height: 1.1;
  transform: rotate(var(--token-turn, 0deg));
}

.share-url {
  color: rgba(10, 74, 61, .46);
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: .02em;
}

.share-url:empty { display: none; }

.rabbit-watermark {
  position: absolute;
  z-index: 1;
  right: -6%;
  bottom: 4%;
  width: 68%;
  pointer-events: none;
  transform-origin: 68% 72%;
  animation: rabbitBreathe 7s ease-in-out infinite alternate;
}

.birthday-background {
  position: absolute;
  z-index: 1;
  top: 73px;
  right: -8px;
  left: -7px;
  display: grid;
  color: rgba(8, 169, 121, 0);
  font-size: 44px;
  line-height: .97;
  letter-spacing: -.03em;
  pointer-events: none;
  transform: rotate(-7deg);
  transition: color .7s ease;
}

.birthday-background span:nth-child(2) { margin-left: 102px; }
.birthday-background span:nth-child(3) { margin: 8px 0 0 20px; font-size: 27px; letter-spacing: .05em; }

.birthday-mode .birthday-background {
  color: rgba(8, 169, 121, .105);
  animation: birthdayBreathe 5.5s ease-in-out infinite alternate;
}

.birthday-background.birthday-background {
  z-index: 4;
  top: 5%;
  right: auto;
  left: 8%;
  display: flex;
  width: 38%;
  align-items: flex-start;
  flex-direction: column;
  font-size: inherit;
  line-height: 1;
  letter-spacing: normal;
  transform: none;
}

.birthday-date {
  color: rgba(10, 74, 61, 0);
  font-size: 11px;
  letter-spacing: .1em;
}

.birthday-background .birthday-date.birthday-date {
  margin: 6px 0 0 1px;
}

.birthday-wish {
  color: rgba(8, 169, 121, 0);
}

.birthday-background .birthday-wish.birthday-wish {
  display: flex;
  margin: 0;
  align-items: flex-start;
  flex-direction: column;
  white-space: nowrap;
}

.birthday-name,
.birthday-message {
  color: inherit;
  font-weight: 400;
  line-height: .98;
}

.birthday-name {
  font-size: 27px;
  letter-spacing: .08em;
}

.birthday-message {
  margin: 2px 0 0;
  font-size: 22px;
  letter-spacing: .035em;
}

.birthday-mode .birthday-background.birthday-background {
  animation: birthdayTitleReveal 8s cubic-bezier(.18, .78, .2, 1) both;
}

.birthday-mode .birthday-date { color: rgba(10, 74, 61, .34); }
.birthday-mode .birthday-wish { color: rgba(8, 169, 121, .22); }

.birthday-mode .share-poem {
  top: 50%;
  animation: birthdayPoemReveal 8s cubic-bezier(.2, .72, .18, 1) both;
}

.birthday-mode .share-card .rabbit-watermark {
  animation:
    rabbitBreathe 7s ease-in-out infinite alternate,
    birthdayRabbitReveal 8s ease both;
}

.birthday-butterflies {
  position: fixed;
  z-index: 18;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.birthday-butterfly {
  position: absolute;
  top: var(--butterfly-start-y);
  left: var(--butterfly-left);
  width: var(--butterfly-size);
  height: var(--butterfly-size);
  opacity: 0;
  filter: drop-shadow(0 0 7px rgba(59, 214, 203, .24));
  transform: rotate(var(--butterfly-turn));
  animation: birthdayButterflyTravel var(--butterfly-duration) cubic-bezier(.18, .55, .3, 1) var(--butterfly-delay) both;
}

.birthday-butterfly::after {
  position: absolute;
  z-index: 2;
  top: 34%;
  left: 46%;
  width: 8%;
  height: 36%;
  border-radius: 999px;
  background: linear-gradient(var(--butterfly-gradient-angle), var(--butterfly-color-a), var(--butterfly-color-b));
  content: "";
}

.butterfly-wing {
  position: absolute;
  display: block;
  opacity: .92;
  filter: blur(.35px);
  transform-origin: 50% 76%;
  animation: butterflyWingFloat 1.15s ease-in-out infinite alternate;
}

.wing-left-top,
.wing-right-top {
  top: 2%;
  width: var(--wing-top-width);
  height: var(--wing-top-height);
  background: linear-gradient(var(--butterfly-gradient-angle), var(--butterfly-color-a), var(--butterfly-color-b));
}

.wing-left-bottom,
.wing-right-bottom {
  top: var(--wing-bottom-top);
  width: var(--wing-bottom-width);
  height: var(--wing-bottom-height);
  background: linear-gradient(var(--butterfly-gradient-angle), var(--butterfly-color-b), var(--butterfly-color-c));
}

.wing-left-top {
  --wing-turn: var(--wing-left-top-turn);
  left: 3%;
  border-radius: var(--wing-left-top-radius);
  transform: rotate(var(--wing-turn));
}

.wing-right-top {
  --wing-turn: var(--wing-right-top-turn);
  right: 3%;
  border-radius: var(--wing-right-top-radius);
  transform: rotate(var(--wing-turn));
  animation-delay: -.4s;
}

.wing-left-bottom {
  --wing-turn: var(--wing-left-bottom-turn);
  left: 12%;
  border-radius: var(--wing-left-bottom-radius);
  transform: rotate(var(--wing-turn));
  animation-delay: -.72s;
}

.wing-right-bottom {
  --wing-turn: var(--wing-right-bottom-turn);
  right: 12%;
  border-radius: var(--wing-right-bottom-radius);
  transform: rotate(var(--wing-turn));
  animation-delay: -.18s;
}

.butterfly-form-0 {
  --wing-top-width: 48%;
  --wing-top-height: 62%;
  --wing-bottom-top: 49%;
  --wing-bottom-width: 38%;
  --wing-bottom-height: 43%;
  --wing-left-top-turn: -29deg;
  --wing-right-top-turn: 29deg;
  --wing-left-bottom-turn: 23deg;
  --wing-right-bottom-turn: -23deg;
  --wing-left-top-radius: 74% 26% 66% 34% / 39% 58% 42% 61%;
  --wing-right-top-radius: 26% 74% 34% 66% / 58% 39% 61% 42%;
  --wing-left-bottom-radius: 62% 38% 72% 28% / 48% 61% 39% 52%;
  --wing-right-bottom-radius: 38% 62% 28% 72% / 61% 48% 52% 39%;
}

.butterfly-form-1 {
  --wing-top-width: 43%;
  --wing-top-height: 70%;
  --wing-bottom-top: 55%;
  --wing-bottom-width: 42%;
  --wing-bottom-height: 34%;
  --wing-left-top-turn: -18deg;
  --wing-right-top-turn: 18deg;
  --wing-left-bottom-turn: 31deg;
  --wing-right-bottom-turn: -31deg;
  --wing-left-top-radius: 60% 40% 78% 22% / 28% 55% 45% 72%;
  --wing-right-top-radius: 40% 60% 22% 78% / 55% 28% 72% 45%;
  --wing-left-bottom-radius: 72% 28% 58% 42% / 62% 46% 54% 38%;
  --wing-right-bottom-radius: 28% 72% 42% 58% / 46% 62% 38% 54%;
}

.butterfly-form-2 {
  --wing-top-width: 54%;
  --wing-top-height: 54%;
  --wing-bottom-top: 44%;
  --wing-bottom-width: 34%;
  --wing-bottom-height: 50%;
  --wing-left-top-turn: -38deg;
  --wing-right-top-turn: 38deg;
  --wing-left-bottom-turn: 14deg;
  --wing-right-bottom-turn: -14deg;
  --wing-left-top-radius: 82% 18% 54% 46% / 48% 68% 32% 52%;
  --wing-right-top-radius: 18% 82% 46% 54% / 68% 48% 52% 32%;
  --wing-left-bottom-radius: 54% 46% 78% 22% / 40% 72% 28% 60%;
  --wing-right-bottom-radius: 46% 54% 22% 78% / 72% 40% 60% 28%;
}

.butterfly-form-3 {
  --wing-top-width: 46%;
  --wing-top-height: 64%;
  --wing-bottom-top: 51%;
  --wing-bottom-width: 44%;
  --wing-bottom-height: 39%;
  --wing-left-top-turn: -24deg;
  --wing-right-top-turn: 33deg;
  --wing-left-bottom-turn: 27deg;
  --wing-right-bottom-turn: -17deg;
  --wing-left-top-radius: 68% 32% 84% 16% / 34% 62% 38% 66%;
  --wing-right-top-radius: 32% 68% 16% 84% / 62% 34% 66% 38%;
  --wing-left-bottom-radius: 80% 20% 61% 39% / 55% 70% 30% 45%;
  --wing-right-bottom-radius: 20% 80% 39% 61% / 70% 55% 45% 30%;
}

.spark {
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 3px rgba(156, 238, 227, .25), 0 0 17px rgba(59, 214, 203, .4);
  opacity: 0;
}

.spark-one { top: 88px; right: 28px; }
.spark-two { bottom: 86px; left: 35px; width: 6px; height: 6px; }
.spark-three { right: 55px; bottom: 48px; width: 5px; height: 5px; }
.birthday-mode .spark { opacity: .9; animation: birthdayFloat 3.8s ease-in-out infinite alternate; }
.birthday-mode .spark-two { animation-delay: -1.4s; }
.birthday-mode .spark-three { animation-delay: -2.5s; }

.share-actions {
  position: sticky;
  z-index: 6;
  bottom: 0;
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding: 16px 22px calc(var(--action-bottom-gap) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(242, 251, 237, .91) 24%, rgba(242, 251, 237, .99) 58%);
}

.save-only-button { width: min(100%, 280px); }

.secondary-button {
  border: 1px solid rgba(8, 169, 121, .22);
  color: var(--ink);
  background: rgba(253, 255, 249, .72);
}

.save-layer {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: max(28px, env(safe-area-inset-top));
  background: rgba(5, 65, 53, .26);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.save-layer.is-open { opacity: 1; pointer-events: auto; }

.save-sheet {
  width: min(100%, 460px);
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  border: 1px solid rgba(8, 169, 121, .2);
  border-radius: 28px 28px 0 0;
  background: #fbfff7;
  box-shadow: 0 -25px 75px rgba(8, 126, 99, .22);
  transform: translateY(105%);
  transition: transform .46s cubic-bezier(.2, .8, .2, 1);
}

.save-layer.is-open .save-sheet { transform: translateY(0); }

.save-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.save-head h2 { margin: 0; font-size: 20px; font-weight: 400; }
.save-head p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.save-preview-wrap {
  width: min(100%, 270px);
  margin: 0 auto 14px;
  overflow: hidden;
  background: #f5fbf1;
  box-shadow: 0 16px 38px rgba(8, 126, 99, .14);
}

.save-preview {
  display: block;
  width: 100%;
  height: auto;
  -webkit-touch-callout: default;
  user-select: auto;
  -webkit-user-select: auto;
}

.save-download-link {
  display: grid;
  width: min(100%, 270px);
  min-height: 48px;
  margin: 0 auto;
  place-items: center;
  border-radius: 999px;
  text-decoration: none;
}

.toast {
  position: fixed;
  z-index: 50;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  padding: 9px 15px;
  border: 1px solid rgba(8, 169, 121, .2);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(253, 255, 249, .9);
  box-shadow: 0 10px 35px rgba(8, 126, 99, .14);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity .25s ease, transform .25s ease;
  white-space: nowrap;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes windDrift { to { translate: var(--drift-x) var(--drift-y); } }
@keyframes assembledDrift { to { translate: var(--settle-x, 3px) var(--settle-y, -3px); } }
@keyframes ambientLime { to { transform: translate(34px, -15px) rotate(7deg) scale(1.06); } }
@keyframes ambientWater { to { transform: translate(-35px, -20px) rotate(-8deg) scale(1.08); } }
@keyframes editorLightOne {
  0% {
    border-radius: 48% 52% 64% 36% / 45% 38% 62% 55%;
    background-position: 15% 38%;
    filter: blur(39px);
    opacity: .42;
    transform: translate3d(0, 0, 0) rotate(-7deg) scale(.92);
  }
  32% {
    border-radius: 62% 38% 46% 54% / 38% 57% 43% 62%;
    background-position: 55% 22%;
    filter: blur(25px);
    opacity: .8;
    transform: translate3d(-46px, 32px, 0) rotate(5deg) scale(1.12);
  }
  68% {
    border-radius: 39% 61% 57% 43% / 58% 36% 64% 42%;
    background-position: 76% 62%;
    filter: blur(34px);
    opacity: .58;
    transform: translate3d(-20px, 82px, 0) rotate(12deg) scale(1.02);
  }
  100% {
    border-radius: 56% 44% 37% 63% / 43% 64% 36% 57%;
    background-position: 38% 78%;
    filter: blur(27px);
    opacity: .84;
    transform: translate3d(-66px, 46px, 0) rotate(-3deg) scale(1.2);
  }
}

@keyframes editorLightTwo {
  0% {
    border-radius: 55% 45% 38% 62% / 61% 42% 58% 39%;
    background-position: 72% 28%;
    filter: blur(38px);
    opacity: .4;
    transform: translate3d(0, 0, 0) rotate(7deg) scale(.94);
  }
  36% {
    border-radius: 38% 62% 59% 41% / 44% 62% 38% 56%;
    background-position: 34% 55%;
    filter: blur(28px);
    opacity: .74;
    transform: translate3d(54px, -30px, 0) rotate(-6deg) scale(1.09);
  }
  72% {
    border-radius: 64% 36% 46% 54% / 58% 39% 61% 42%;
    background-position: 18% 76%;
    filter: blur(35px);
    opacity: .52;
    transform: translate3d(26px, -72px, 0) rotate(-12deg) scale(1);
  }
  100% {
    border-radius: 43% 57% 63% 37% / 37% 55% 45% 63%;
    background-position: 58% 42%;
    filter: blur(26px);
    opacity: .78;
    transform: translate3d(70px, -42px, 0) rotate(4deg) scale(1.16);
  }
}
@keyframes rabbitBreathe { to { transform: translate(-3px, -4px) scale(1.012); } }
@keyframes birthdayBreathe { to { color: rgba(8, 169, 121, .16); transform: rotate(-4deg) translate(6px, -4px); } }
@keyframes birthdayTitleReveal {
  0% { opacity: 0; filter: blur(7px); transform: translate(28%, 76px) scale(.92); }
  18% { opacity: 1; filter: blur(0); transform: translate(28%, 76px) scale(1.08); }
  48% { opacity: 1; filter: blur(0); transform: translate(28%, 76px) scale(1.08); }
  62%, 100% { opacity: 1; filter: blur(0); transform: translate(0, 0) scale(1); }
}
@keyframes birthdayPoemReveal {
  0%, 68% { opacity: 0; filter: blur(7px); transform: translateY(-46%); }
  84%, 100% { opacity: 1; filter: blur(0); transform: translateY(-50%); }
}
@keyframes birthdayRabbitReveal {
  0%, 70% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes birthdayButterflyTravel {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(var(--butterfly-turn)) scale(.38); }
  6% { opacity: var(--butterfly-opacity); }
  22% { opacity: var(--butterfly-opacity); transform: translate3d(var(--butterfly-inner-x), var(--butterfly-inner-y), 0) rotate(var(--butterfly-mid-turn)) scale(1); }
  55% { opacity: var(--butterfly-opacity); transform: translate3d(var(--butterfly-mid-x), var(--butterfly-mid-y), 0) rotate(var(--butterfly-late-turn)) scale(.96); }
  78% { opacity: .68; transform: translate3d(var(--butterfly-late-x), var(--butterfly-late-y), 0) rotate(var(--butterfly-end-turn)) scale(.88); }
  100% { opacity: 0; transform: translate3d(var(--butterfly-end-x), var(--butterfly-end-y), 0) rotate(var(--butterfly-end-turn)) scale(.74); }
}
@keyframes butterflyWingFloat {
  to { filter: blur(.65px); transform: rotate(var(--wing-turn)) scaleX(.78); }
}
@keyframes birthdayFloat { to { opacity: .35; transform: translate(7px, -13px) scale(.62); } }
@keyframes candidateWindOut {
  to { opacity: 0; transform: translate(105px, -24px) rotate(12deg) scale(.82); }
}
@keyframes candidateWindIn {
  from { opacity: 0; transform: translate(-92px, 22px) rotate(-10deg) scale(.86); }
}

@media (min-width: 461px) {
  .app { min-height: 820px; margin-top: 12px; margin-bottom: 12px; border-radius: 36px; }
  .screen { min-height: 820px; }
  .library-sheet { border-radius: 31px; margin-bottom: 12px; }
}

@media (max-height: 720px) {
  :root { --action-bottom-gap: 44px; }
  .poem-editor { min-height: 330px; padding-top: 18px; }
  .poem-row { min-height: 52px; }
  .candidate-tray { min-height: 108px; }
  .word-chip { min-height: 47px; }
  .share-card-wrap { padding: 4px 58px 9px; }
  .share-card { width: min(100%, 226px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
