@font-face {
  font-family: Figtree;
  src: url(/fonts/figtree-latin-wght-normal.woff2) format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: Figtree;
  src: url(/fonts/figtree-latin-ext-wght-normal.woff2) format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --night: #02030f;
  --dusk: #0a0f3a;
  --ink: #f4f6ff;
  --soft: rgba(244, 246, 255, 0.68);
  --line: rgba(244, 246, 255, 0.2);
  --bark: #7c5a78;
  --leaf: #c6e05a;
  --green: #4ac959;
  --warn: #ffc450;
  --light: #6fe3ff;
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--dusk), var(--night) 78%);
  color: var(--ink);
  font-family: Figtree, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Cerul din imaginea aprobata. Doar gradiente: filter:blur blocheaza randarea pe iOS. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(2px 2px at 14% 11%, #cdb4ff, transparent),
    radial-gradient(2px 2px at 82% 7%, #7fb2ff, transparent),
    radial-gradient(1.5px 1.5px at 67% 19%, #ffffff, transparent),
    radial-gradient(2px 2px at 91% 34%, #f0a6ff, transparent),
    radial-gradient(1.5px 1.5px at 7% 46%, #8fe9ff, transparent),
    radial-gradient(1.5px 1.5px at 94% 71%, #ffffff, transparent),
    radial-gradient(2px 2px at 21% 86%, #d6ff8f, transparent),
    radial-gradient(90vw 60vh at 50% 108%, rgba(42, 47, 143, 0.5), transparent 70%);
}

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

header { display: flex; align-items: center; gap: 12px; animation: rise 0.6s both; }

.logo { width: auto; height: 46px; }

.title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--soft);
}

form, #done { flex: 1; display: flex; flex-direction: column; }

h1 {
  margin: clamp(26px, 6vh, 52px) 0 22px;
  font-size: clamp(29px, 8.2vw, 38px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
  animation: rise 0.6s 0.08s both;
}

textarea {
  display: block;
  width: 100%;
  min-height: 132px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(244, 246, 255, 0.06);
  color: var(--ink);
  font: 500 18px/1.4 Figtree, "Segoe UI", sans-serif;
  resize: none;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  animation: rise 0.6s 0.16s both;
}

textarea::placeholder { color: rgba(244, 246, 255, 0.45); }

textarea:focus {
  border-color: var(--light);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--light) 25%, transparent);
}

.grow { margin-top: 10px; animation: rise 0.6s 0.24s both; }

.grow svg { display: block; width: 100%; height: auto; overflow: visible; }

.branch {
  fill: none;
  stroke: var(--light);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.35s ease-out;
}

.branch.rest { stroke: var(--bark); stroke-opacity: 0.55; stroke-dasharray: none; stroke-dashoffset: 0; }

.leaf { opacity: 0; transform-box: fill-box; transform-origin: 0 100%; transform: scale(0.4); transition: opacity 0.3s, transform 0.3s; }
.leaf.on { opacity: 1; transform: none; }
.leaf path { fill: none; stroke: var(--bark); stroke-width: 1.6; stroke-linecap: round; }
.leaf circle { fill: var(--leaf); }

#bud { transition: transform 0.35s ease-out; }
.core { fill: #fff; }
.halo-in { stop-color: var(--light); stop-opacity: 0.85; }
.halo-out { stop-color: var(--light); stop-opacity: 0; }

.count {
  margin: 2px 0 0;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
}

.count.near { color: var(--warn); font-weight: 700; }

#status { min-height: 22px; margin: 6px 0 10px; color: var(--warn); font-size: 15px; font-weight: 600; line-height: 1.3; }

button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: #04122a;
  font: 800 18px Figtree, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.2s;
  touch-action: manipulation;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

#send { animation: rise 0.6s 0.32s both; }

#note { margin: 14px 0 0; font-size: 14px; line-height: 1.4; color: var(--soft); }

/* Dupa trimitere: mugurele inflorit. */
#done { justify-content: center; text-align: center; outline: none; }
#done[hidden] { display: none; }
#done h1 { margin: 34px 0 10px; }
#done p { margin: 0 0 34px; font-size: 18px; line-height: 1.4; color: var(--soft); animation: rise 0.6s 0.2s both; }
#again { background: transparent; color: var(--ink); border: 1px solid var(--line); animation: rise 0.6s 0.3s both; }

.bloom {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--light) 70%, transparent), transparent 68%);
  animation: bloom 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both, breathe 3.2s 0.9s ease-in-out infinite;
}

.bloom span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px;
  border-radius: 50%;
  background: #fff;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes bloom { from { opacity: 0; transform: scale(0.15); } }
@keyframes breathe { 50% { transform: scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
