/* ================== Base ================== */
:root {
  --ci-cyan: #00aec7;
  --ci-cyan-dark: #0093a8;
  --ci-cyan-light: #e6f7fa;
  --ci-yellow: #ffd305;
  --ci-yellow-dark: #e6bd00;
  --ink: #1f2a37;
  --ink-soft: #4b5563;
  --ink-mute: #8a94a3;
  --bg: #ffffff;
  --bg-soft: #f7faf9;
  --line: #e6ebef;
  --leaf: #3aaf7a;
  --leaf-dark: #1f7a4d;
  --shadow-sm: 0 4px 14px rgba(15, 40, 60, 0.06);
  --shadow-md: 0 12px 40px rgba(15, 40, 60, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* Subtle eco background pattern */
body.page-public::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(0,174,199,0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255,211,5,0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--ci-cyan-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================== Floating leaves ================== */
.leaves {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.leaves .leaf {
  position: absolute;
  font-size: 22px;
  opacity: 0.55;
  animation: floatLeaf linear infinite;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.06));
}
.leaves .leaf:nth-child(1) { left: 5%;  top: -30px;  animation-duration: 18s; animation-delay: 0s;   }
.leaves .leaf:nth-child(2) { left: 18%; top: -50px;  animation-duration: 22s; animation-delay: 3s;   font-size: 28px; }
.leaves .leaf:nth-child(3) { left: 32%; top: -40px;  animation-duration: 25s; animation-delay: 7s;   }
.leaves .leaf:nth-child(4) { left: 50%; top: -60px;  animation-duration: 20s; animation-delay: 1s;   font-size: 18px; }
.leaves .leaf:nth-child(5) { left: 65%; top: -30px;  animation-duration: 24s; animation-delay: 5s;   font-size: 26px; }
.leaves .leaf:nth-child(6) { left: 78%; top: -50px;  animation-duration: 19s; animation-delay: 9s;   }
.leaves .leaf:nth-child(7) { left: 88%; top: -40px;  animation-duration: 23s; animation-delay: 2s;   font-size: 24px; }
.leaves .leaf:nth-child(8) { left: 95%; top: -55px;  animation-duration: 26s; animation-delay: 11s;  }

@keyframes floatLeaf {
  0%   { transform: translateY(-10vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.55; }
  100% { transform: translateY(115vh) rotate(360deg); opacity: 0; }
}

/* ================== Topbar ================== */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.logo-img {
  height: 48px;
  width: auto;
  display: block;
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 0.3px; }
.brand-name span { color: var(--ci-cyan); }
.brand-name-cyan { color: var(--ci-cyan); font-weight: 800; }
.brand-black { color: #000; }
.brand-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.topbar-link {
  font-size: 14px; font-weight: 500;
  color: var(--ci-cyan-dark);
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--ci-cyan-light);
  background: var(--ci-cyan-light);
  transition: all .2s ease;
}
.topbar-link:hover { background: var(--ci-cyan); color: white; text-decoration: none; }

/* ================== Hero ================== */
.hero {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 480px);
  gap: 48px;
  max-width: 1240px;
  margin: 40px auto 60px;
  padding: 0 36px;
}

.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--ci-yellow) 0%, #ffe57a 100%);
  color: #5a4500;
  font-weight: 700; font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(255,211,5,0.35);
}
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ci-cyan); }

.hero-title {
  font-size: 46px;
  line-height: 1.1;
  font-weight: 800;
  margin: 18px 0 16px;
  letter-spacing: -0.5px;
}
.title-line {
  display: block;
  white-space: nowrap;
  background: linear-gradient(120deg, var(--ci-cyan) 0%, #38d6ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title-hash {
  background: linear-gradient(120deg, var(--leaf-dark) 0%, var(--leaf) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 1100px) {
  .hero-title { font-size: 40px; }
}
@media (max-width: 720px) {
  .hero-title { font-size: 32px; }
  .title-line { white-space: normal; }
}
.heart { display: inline-block; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}

.hero-desc {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 0 28px;
}

/* ================== Card / Form ================== */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.form-card { padding: 30px; }
.form-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--ink);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field .optional { color: var(--ink-mute); font-weight: 400; }

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fbfdfd;
  transition: all .2s ease;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path d='M3 5l4 4 4-4' stroke='%2300aec7' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  padding-right: 38px;
  cursor: pointer;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--ci-cyan);
  background-color: white;
  box-shadow: 0 0 0 4px rgba(0,174,199,0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(135deg, var(--ci-cyan) 0%, #00c7e0 100%);
  color: white;
  box-shadow: 0 8px 20px rgba(0,174,199,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0,174,199,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: white;
  color: var(--ci-cyan-dark);
  border: 1.5px solid var(--ci-cyan-light);
}
.btn-secondary:hover { background: var(--ci-cyan-light); }

.btn-yellow {
  background: linear-gradient(135deg, var(--ci-yellow) 0%, #ffe04a 100%);
  color: #4d3900;
  box-shadow: 0 8px 20px rgba(255,211,5,0.45);
}
.btn-yellow:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(255,211,5,0.55); }

.form-msg {
  margin: 12px 0 0;
  font-size: 14px;
  min-height: 20px;
}
.form-msg.success { color: var(--leaf-dark); font-weight: 600; }
.form-msg.error { color: #c0392b; font-weight: 500; }

/* ================== Tree Card ================== */
.tree-card {
  position: sticky; top: 24px;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
  border: 1px solid #def0e7;
}

.tree-header h3 { margin: 0 0 4px; font-size: 18px; }
.tree-header p { margin: 0; color: var(--ink-mute); font-size: 13px; }

.tree-stage {
  position: relative;
  margin: 12px 0 18px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #eaf7ff 0%, #f6fff5 60%, #ffffff 100%);
  height: 320px;
}
.tree-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 2;
}
.tree-sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,211,5,0.45) 0, transparent 14%),
    radial-gradient(circle at 75% 30%, rgba(255,255,255,0.7) 0, transparent 12%),
    radial-gradient(circle at 60% 18%, rgba(255,255,255,0.55) 0, transparent 10%);
  z-index: 1;
}

/* ===== Illustrated SVG tree stages (cross-faded) ===== */
.tree-stage-illus {
  background: linear-gradient(180deg, #7ec8f5 0%, #bce5fc 55%, #e2f5cf 100%);
  /* Container shape matches SVG viewBox (5:6 portrait) so nothing gets cropped */
  aspect-ratio: 5 / 6;
  height: auto !important;
}
/* Index card: cap so the right column doesn't grow too tall */
.tree-card .tree-stage-illus {
  max-height: 460px;
}
.tree-stage-illus .illus-tree {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
}
.tree-stage-illus .i-stage {
  opacity: 0;
  transform: scale(0.92);
  transform-origin: 200px 470px;
  transition: opacity 1s ease, transform 1.4s cubic-bezier(.25,1.4,.45,1);
}
.tree-stage-illus[data-stage="0"] .i-stage-1,
.tree-stage-illus[data-stage="1"] .i-stage-1,
.tree-stage-illus[data-stage="2"] .i-stage-2,
.tree-stage-illus[data-stage="3"] .i-stage-3,
.tree-stage-illus[data-stage="4"] .i-stage-4 {
  opacity: 1;
  transform: scale(1);
}

/* Sun gentle pulse */
.tree-stage-illus .i-sun-group {
  transform-origin: 340px 90px;
  animation: iSunPulse 4s ease-in-out infinite;
}
@keyframes iSunPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* Cloud drift */
.tree-stage-illus .i-cloud-1 { animation: iCloud1 22s ease-in-out infinite; }
.tree-stage-illus .i-cloud-2 { animation: iCloud2 28s ease-in-out infinite reverse; }
@keyframes iCloud1 {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(28px); }
}
@keyframes iCloud2 {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-22px); }
}

/* Tiny sprout sway in stage 1 */
.tree-stage-illus .i-tiny-sprout {
  transform-origin: 200px 408px;
  animation: iSway 3.5s ease-in-out infinite;
}
.tree-stage-illus .i-sprout {
  transform-origin: 200px 425px;
  animation: iSway 3s ease-in-out infinite;
}
@keyframes iSway {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

/* Foliage gentle bobble (stage 3 + 4) */
.tree-stage-illus .i-foliage-3,
.tree-stage-illus .i-foliage-4 {
  transform-origin: 200px 230px;
  animation: iFoliageBob 5s ease-in-out infinite;
}
@keyframes iFoliageBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-3px) scale(1.012); }
}

/* Bloom glow halo pulse */
.tree-stage-illus .i-bloom-halo {
  transform-origin: 200px 195px;
  animation: iHaloPulse 4s ease-in-out infinite;
}
@keyframes iHaloPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.07); }
}

/* Butterfly flutter */
.tree-stage-illus .i-butterfly {
  animation: iButterfly 6s ease-in-out infinite;
}
@keyframes iButterfly {
  0%   { transform: translate(310px, 200px) rotate(0deg); }
  25%  { transform: translate(280px, 175px) rotate(-12deg); }
  50%  { transform: translate(310px, 150px) rotate(0deg); }
  75%  { transform: translate(340px, 180px) rotate(12deg); }
  100% { transform: translate(310px, 200px) rotate(0deg); }
}

/* Sparkles twinkle */
.tree-stage-illus .i-spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: iTwinkle 2s ease-in-out infinite;
}
.tree-stage-illus .i-spark.s2 { animation-delay: 0.7s; }
.tree-stage-illus .i-spark.s3 { animation-delay: 1.4s; }
@keyframes iTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.6); }
  50%      { opacity: 1;   transform: scale(1.3); }
}

/* Falling petals (bloom only) */
.tree-stage-illus .i-petal {
  animation: iPetalFall 6s ease-in infinite;
}
.tree-stage-illus .i-petal.p2 { animation-delay: 1.5s; animation-duration: 7s; }
.tree-stage-illus .i-petal.p3 { animation-delay: 3s;   animation-duration: 8s; }
.tree-stage-illus .i-petal.p4 { animation-delay: 4.5s; animation-duration: 6.5s; }
@keyframes iPetalFall {
  0%   { transform: translate(0, 0) rotate(0deg);    opacity: 0; }
  10%  { opacity: 0.9; }
  100% { transform: translate(-15px, 130px) rotate(360deg); opacity: 0; }
}

/* Tree shake when register triggered */
.tree-stage-illus.shake .illus-tree {
  animation: iShake 0.6s ease;
}
@keyframes iShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25%      { transform: translateX(-3px) rotate(-1deg); }
  75%      { transform: translateX(3px)  rotate(1deg); }
}

/* ===== Old image-based tree stages (kept for backward compat, hidden) ===== */
.tree-stage-img { display: none !important; }

/* ===== (Legacy) Image-based tree stages ===== */
.tree-stage-img {
  background: linear-gradient(180deg, #cdeaff 0%, #e6f6ff 60%, #ffffff 100%);
}
.tree-stage-img .tree-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  opacity: 0;
  transition: opacity 1.2s ease;
  z-index: 2;
  pointer-events: none;
}
/* Default: stage 0 / 1 → seed */
.tree-stage-img .tree-img-1 { opacity: 1; }
.tree-stage-img[data-stage="0"] .tree-img-1 { opacity: 1; }
.tree-stage-img[data-stage="0"] .tree-img-2,
.tree-stage-img[data-stage="0"] .tree-img-3,
.tree-stage-img[data-stage="0"] .tree-img-4 { opacity: 0; }

.tree-stage-img[data-stage="1"] .tree-img-1 { opacity: 1; }
.tree-stage-img[data-stage="1"] .tree-img-2,
.tree-stage-img[data-stage="1"] .tree-img-3,
.tree-stage-img[data-stage="1"] .tree-img-4 { opacity: 0; }

.tree-stage-img[data-stage="2"] .tree-img-1 { opacity: 0; }
.tree-stage-img[data-stage="2"] .tree-img-2 { opacity: 1; }
.tree-stage-img[data-stage="2"] .tree-img-3,
.tree-stage-img[data-stage="2"] .tree-img-4 { opacity: 0; }

.tree-stage-img[data-stage="3"] .tree-img-1,
.tree-stage-img[data-stage="3"] .tree-img-2 { opacity: 0; }
.tree-stage-img[data-stage="3"] .tree-img-3 { opacity: 1; }
.tree-stage-img[data-stage="3"] .tree-img-4 { opacity: 0; }

.tree-stage-img[data-stage="4"] .tree-img-1,
.tree-stage-img[data-stage="4"] .tree-img-2,
.tree-stage-img[data-stage="4"] .tree-img-3 { opacity: 0; }
.tree-stage-img[data-stage="4"] .tree-img-4 { opacity: 1; }

/* Bloom golden glow */
.tree-stage-img .tree-bloom-glow {
  position: absolute; inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease 0.3s;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 235, 100, 0.30) 0%, transparent 45%),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 220, 0.20) 0%, transparent 35%);
}
.tree-stage-img[data-stage="4"] .tree-bloom-glow {
  opacity: 1;
  animation: bloomGlowPulse 4s ease-in-out infinite;
}
@keyframes bloomGlowPulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* Subtle scale-in for newer stages */
.tree-stage-img .tree-img-2,
.tree-stage-img .tree-img-3,
.tree-stage-img .tree-img-4 {
  transform: scale(0.96);
  transition: opacity 1.2s ease, transform 1.4s cubic-bezier(.25,1.4,.45,1);
}
.tree-stage-img[data-stage="2"] .tree-img-2,
.tree-stage-img[data-stage="3"] .tree-img-3,
.tree-stage-img[data-stage="4"] .tree-img-4 {
  transform: scale(1);
}

/* ===== Legacy SVG cute-tree (kept for fallback only) ===== */
.cute-tree { filter: drop-shadow(0 8px 20px rgba(58, 175, 122, 0.20)); }
.cute-tree .foliage-group,
.cute-tree .trunk-group,
.cute-tree .flowers-group,
.cute-tree .mushrooms-group,
.cute-tree .butterflies-group,
.cute-tree .sparkles-group,
.cute-tree .sprout {
  transition: transform 1.4s cubic-bezier(.25,1.4,.45,1), opacity 0.8s ease;
  transform-origin: 200px 425px;
}
.cute-tree .foliage-group { transform-origin: 205px 220px; }
.cute-tree .trunk-group   { transform-origin: 200px 425px; }
.cute-tree .flowers-group { transform-origin: 205px 200px; }
.cute-tree .butterflies-group { opacity: 0; transition: opacity 1s ease; }
.cute-tree .sparkles-group { opacity: 0; transition: opacity 1s ease; }
.cute-tree .flowers-group { opacity: 0; }
.cute-tree .mushrooms-group { opacity: 0; transition: opacity 0.8s ease; }
.cute-tree .grass-group { opacity: 0.6; }

/* Stage 0 — empty land + sprout */
.tree-stage[data-stage="0"] .cute-tree .foliage-group { transform: scale(0); }
.tree-stage[data-stage="0"] .cute-tree .trunk-group   { transform: scaleY(0); }
.tree-stage[data-stage="0"] .cute-tree .sprout        { opacity: 1; transform: scale(1); }

/* Stage 1 — small sapling */
.tree-stage[data-stage="1"] .cute-tree .foliage-group { transform: scale(0.30) translateY(280px); }
.tree-stage[data-stage="1"] .cute-tree .trunk-group   { transform: scaleY(0.42); transform-origin: 200px 425px; }
.tree-stage[data-stage="1"] .cute-tree .sprout        { opacity: 0; transform: scale(0.7); }

/* Stage 2 — sapling */
.tree-stage[data-stage="2"] .cute-tree .foliage-group { transform: scale(0.55) translateY(150px); }
.tree-stage[data-stage="2"] .cute-tree .trunk-group   { transform: scaleY(0.65); transform-origin: 200px 425px; }
.tree-stage[data-stage="2"] .cute-tree .sprout        { opacity: 0; }
.tree-stage[data-stage="2"] .cute-tree .mushrooms-group { opacity: 1; }

/* Stage 3 — full tree */
.tree-stage[data-stage="3"] .cute-tree .foliage-group { transform: scale(0.85) translateY(35px); }
.tree-stage[data-stage="3"] .cute-tree .trunk-group   { transform: scaleY(0.9); transform-origin: 200px 425px; }
.tree-stage[data-stage="3"] .cute-tree .sprout        { opacity: 0; }
.tree-stage[data-stage="3"] .cute-tree .mushrooms-group { opacity: 1; }

/* Stage 4 — bloom (full grown, lush) */
.tree-stage[data-stage="4"] .cute-tree { filter: drop-shadow(0 0 30px rgba(80, 220, 140, 0.5)) drop-shadow(0 12px 28px rgba(58,175,122,0.3)); }
.tree-stage[data-stage="4"] .cute-tree .foliage-group { transform: scale(1.12) translateY(-10px); }
.tree-stage[data-stage="4"] .cute-tree .trunk-group   { transform: scaleY(1.05); transform-origin: 200px 425px; }
.tree-stage[data-stage="4"] .cute-tree .sprout        { opacity: 0; }
.tree-stage[data-stage="4"] .cute-tree .flowers-group { opacity: 1; transition-delay: 0.3s; transform: scale(1.05); }
.tree-stage[data-stage="4"] .cute-tree .butterflies-group { opacity: 1; transition-delay: 0.5s; }
.tree-stage[data-stage="4"] .cute-tree .sparkles-group { opacity: 1; transition-delay: 0.7s; }
.tree-stage[data-stage="4"] .cute-tree .mushrooms-group { opacity: 1; }

/* Light rays at bloom stage */
.tree-stage[data-stage="4"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 235, 100, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 30% 25%, rgba(255, 255, 200, 0.12) 0%, transparent 35%);
  pointer-events: none;
  z-index: 4;
  animation: bloomGlow 4s ease-in-out infinite;
}
@keyframes bloomGlow {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* Sun gentle pulse */
.cute-tree .sun-group { transform-origin: 340px 80px; animation: sunPulse 4s ease-in-out infinite; }
@keyframes sunPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* Cloud drift */
.cute-tree .cloud { animation: cloudDrift 18s ease-in-out infinite; }
@keyframes cloudDrift {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(20px); }
}

/* Butterfly flutter */
.cute-tree .butterfly-1 {
  animation: butterfly1 6s ease-in-out infinite;
}
.cute-tree .butterfly-2 {
  animation: butterfly2 7s ease-in-out infinite;
}
@keyframes butterfly1 {
  0%   { transform: translate(310px, 170px) rotate(0deg); }
  25%  { transform: translate(280px, 150px) rotate(-15deg); }
  50%  { transform: translate(310px, 130px) rotate(0deg); }
  75%  { transform: translate(335px, 160px) rotate(15deg); }
  100% { transform: translate(310px, 170px) rotate(0deg); }
}
@keyframes butterfly2 {
  0%   { transform: translate(95px, 200px) rotate(0deg); }
  33%  { transform: translate(115px, 175px) rotate(-10deg); }
  66%  { transform: translate(75px, 165px) rotate(10deg); }
  100% { transform: translate(95px, 200px) rotate(0deg); }
}

/* Sparkle twinkle */
.cute-tree .sparkle {
  animation: twinkle 2s ease-in-out infinite;
  transform-origin: center;
}
.cute-tree .sparkle:nth-child(1) { animation-delay: 0s; }
.cute-tree .sparkle:nth-child(2) { animation-delay: 0.7s; }
.cute-tree .sparkle:nth-child(3) { animation-delay: 1.4s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.6); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

/* Tree shake on register — also gentle wiggle when bloomed */
.tree-stage[data-stage="4"] .cute-tree .foliage-group {
  animation: foliageBob 3s ease-in-out infinite;
}
@keyframes foliageBob {
  0%, 100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.02) translateY(-3px); }
}

/* Drops animation */
.drops {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.drops .drop {
  position: absolute;
  top: -10px;
  width: 8px; height: 14px;
  background: linear-gradient(180deg, #6dd6ff, #00aec7);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0.85;
  animation: dropFall 1s ease-in forwards;
  box-shadow: 0 0 8px rgba(0, 174, 199, 0.5);
}
@keyframes dropFall {
  0%   { transform: translateY(0) scale(1);     opacity: 0; }
  20%  { opacity: 1; }
  90%  { transform: translateY(220px) scale(1); opacity: 1; }
  100% { transform: translateY(240px) scale(0); opacity: 0; }
}

/* Tree shake on register */
.tree-stage.shake .tree-svg {
  animation: shake 0.6s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}

/* Stats */
.tree-stats { padding: 4px 4px 8px; }
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stat-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--ci-cyan-dark);
  line-height: 1;
}
.stat-total { font-size: 18px; color: var(--ink-mute); font-weight: 500; }
.stat-label { color: var(--ink-soft); font-size: 13px; }

.progress {
  height: 12px;
  background: #e6f0ec;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--leaf) 0%, var(--ci-cyan) 70%, var(--ci-yellow) 110%);
  transition: width 1s cubic-bezier(.25,1.4,.45,1);
  border-radius: 999px;
}
.stat-percent {
  font-size: 12px; color: var(--ink-mute); text-align: right;
}

.stage-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #d8ebe1;
}
.stage-badge {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: #f0faf5;
  opacity: 0.4;
  transition: all .3s ease;
}
.stage-badge span { font-size: 22px; display: block; }
.stage-badge small { font-size: 11px; color: var(--ink-soft); display: block; margin-top: 2px; }
.stage-badge.active {
  opacity: 1;
  background: linear-gradient(135deg, #fff8d4 0%, #e0f5ff 100%);
  box-shadow: 0 4px 12px rgba(0,174,199,0.15);
  transform: translateY(-2px);
}

/* ================== Footer ================== */
.footer {
  position: relative;
  z-index: 2;
  padding: 24px 36px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-mute);
  background: var(--bg-soft);
}
.footer-tag { color: var(--leaf-dark); font-weight: 600; }

/* ================== Responsive ================== */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 24px;
  }
  .hero-title { font-size: 36px; }
  .tree-card { position: static; }
}
@media (max-width: 560px) {
  .topbar { padding: 14px 18px; }
  .hero { padding: 0 18px; }
  .hero-title { font-size: 30px; }
  .footer { flex-direction: column; gap: 6px; padding: 18px; text-align: center; }
}

/* ================== Admin & Lucky Draw ================== */
.page-admin {
  background: var(--bg-soft);
}
.admin-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 36px 60px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header h1 {
  font-size: 26px;
  margin: 0;
  font-weight: 800;
}
.admin-header .accent {
  background: linear-gradient(120deg, var(--ci-cyan), var(--ci-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.admin-tabs {
  display: flex; gap: 8px;
}
.admin-tabs a {
  padding: 8px 16px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.admin-tabs a:hover { text-decoration: none; background: var(--ci-cyan-light); }
.admin-tabs a.active {
  background: var(--ci-cyan);
  color: white;
  border-color: var(--ci-cyan);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: white;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.kpi .label {
  font-size: 12px; color: var(--ink-mute); font-weight: 500;
  text-transform: uppercase; letter-spacing: 1px;
}
.kpi .value {
  font-size: 30px; font-weight: 800;
  margin-top: 6px;
  color: var(--ci-cyan-dark);
}
.kpi.kpi-yellow .value { color: var(--ci-yellow-dark); }
.kpi.kpi-green .value { color: var(--leaf-dark); }
.kpi .sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.panel {
  background: white;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 8px; flex-wrap: wrap;
}
.panel-header h2 { margin: 0; font-size: 18px; font-weight: 700; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .btn { width: auto; padding: 9px 16px; font-size: 13px; }

table.reg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.reg-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-mute);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--line);
}
table.reg-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
table.reg-table tr:hover td { background: var(--bg-soft); }
table.reg-table .num { color: var(--ink-mute); width: 50px; }
table.reg-table .row-actions { text-align: right; }
table.reg-table .del-btn {
  background: transparent;
  border: 1px solid #f3d2d2;
  color: #c0392b;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit; font-size: 12px;
}
table.reg-table .del-btn:hover { background: #fdeaea; }
.empty {
  text-align: center;
  color: var(--ink-mute);
  padding: 36px 0;
  font-size: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 18px;
  align-items: start;
}
.settings-field { }
.settings-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.settings-field input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fbfdfd;
  text-align: center;
  letter-spacing: 1px;
}
.settings-field input:focus {
  outline: none;
  border-color: var(--ci-cyan);
  background: white;
  box-shadow: 0 0 0 4px rgba(0,174,199,0.12);
}
.settings-field small {
  display: block;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 6px;
}
.settings-summary {
  background: linear-gradient(135deg, var(--ci-cyan-light) 0%, #fff8d4 110%);
  border: 1.5px solid var(--ci-cyan-light);
  border-radius: 14px;
  padding: 16px 18px;
}
.settings-summary .ss-row {
  display: flex; justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 4px 0;
}
.settings-summary .ss-row strong {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
}
.settings-summary .ss-row.ss-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1.5px dashed rgba(0,174,199,0.35);
  font-size: 14px;
}
.settings-summary .ss-row.ss-total strong {
  font-size: 22px;
  color: var(--ci-cyan-dark);
}
.settings-summary .btn { width: 100%; padding: 11px 16px; font-size: 14px; }

@media (max-width: 800px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.search-box {
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit; font-size: 14px;
  min-width: 200px;
}
.search-box:focus { outline: none; border-color: var(--ci-cyan); }

/* Login overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,174,199,0.95) 0%, rgba(255,211,5,0.95) 100%);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}
.login-card h2 { margin: 0 0 8px; font-size: 22px; }
.login-card p { color: var(--ink-mute); margin: 0 0 22px; font-size: 14px; }
.login-card input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 15px;
  margin-bottom: 12px;
}
.login-card input:focus { outline: none; border-color: var(--ci-cyan); }
.login-card .btn { margin-top: 8px; }
.login-error { color: #c0392b; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* Lucky Draw page */
.draw-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 36px 60px;
}
.draw-stage {
  background: linear-gradient(135deg, #00aec7 0%, #19c8d3 50%, #ffd305 130%);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  color: white;
  box-shadow: 0 30px 60px rgba(0, 174, 199, 0.35);
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}
.draw-stage::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18) 0, transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(255,211,5,0.30) 0, transparent 35%);
}
.draw-stage > * { position: relative; }
.draw-stage h1 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
}
.draw-stage .subtitle {
  font-size: 15px;
  opacity: 0.9;
  margin: 0 0 24px;
}

.draw-display {
  background: rgba(255,255,255,0.15);
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 18px;
  padding: 30px 20px;
  min-height: 120px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  max-width: 760px;
  backdrop-filter: blur(4px);
}
.draw-display .placeholder {
  font-size: 15px;
  opacity: 0.85;
}
.draw-spinning .name {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 4px 14px rgba(0,0,0,0.25);
  animation: spinFast 0.08s linear infinite;
}
@keyframes spinFast {
  0% { transform: translateY(-4px); opacity: 0.4; }
  50% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(4px); opacity: 0.4; }
}
.draw-result {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
}
.draw-result .winner-chip {
  background: white;
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 14px;
  text-align: left;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  animation: chipIn 0.6s cubic-bezier(.25,1.4,.45,1) backwards;
}
.draw-result .winner-chip .wname { font-weight: 700; font-size: 16px; }
.draw-result .winner-chip .wmeta { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }
.draw-result .winner-chip .wdept { display: inline-block; padding: 2px 8px; background: var(--ci-cyan-light); color: var(--ci-cyan-dark); border-radius: 999px; font-size: 11px; font-weight: 600; margin-top: 6px; }

@keyframes chipIn {
  from { transform: scale(0.5) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0);     opacity: 1; }
}
.draw-result .winner-chip:nth-child(1) { animation-delay: 0s; }
.draw-result .winner-chip:nth-child(2) { animation-delay: 0.15s; }
.draw-result .winner-chip:nth-child(3) { animation-delay: 0.30s; }
.draw-result .winner-chip:nth-child(4) { animation-delay: 0.45s; }
.draw-result .winner-chip:nth-child(5) { animation-delay: 0.60s; }
.draw-result .winner-chip:nth-child(n+6) { animation-delay: 0.75s; }

.draw-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}
.draw-controls .field {
  margin: 0;
  text-align: left;
}
.draw-controls .field label {
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.draw-controls input[type="number"] {
  width: 80px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  font: inherit; font-weight: 700; font-size: 16px;
  text-align: center;
}
.draw-controls .checkbox {
  display: flex; align-items: center; gap: 6px;
  color: white;
  font-size: 14px;
}
.draw-controls .btn { width: auto; padding: 14px 28px; font-size: 16px; }

.history-list {
  display: grid; gap: 12px;
}
.history-round {
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 16px;
}
.history-round-head {
  display: flex; justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px; color: var(--ink-mute);
}
.history-round-head strong { color: var(--ink); }
.history-round-winners {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.history-round-winners .pill {
  padding: 5px 12px;
  background: var(--ci-cyan-light);
  color: var(--ci-cyan-dark);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .draw-stage h1 { font-size: 22px; }
  .draw-stage { padding: 28px 18px; }
}

/* Confetti */
.confetti {
  position: fixed;
  pointer-events: none;
  inset: 0;
  z-index: 999;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0); }
  100% { transform: translateY(110vh) rotate(720deg); }
}
