:root {
  --bg-top: #072018;
  --bg-mid: #0a2a1f;
  --bg-bot: #051611;
  --surface: rgba(15, 48, 36, 0.78);
  --surface-strong: #0e2e23;
  --line: rgba(242, 200, 114, 0.22);
  --line-soft: rgba(255, 255, 255, 0.1);
  --gold: #f0be5b;
  --gold-deep: #d99f32;
  --gold-ink: #1a1204;
  --cream: #f7f3e8;
  --muted: rgba(247, 243, 232, 0.68);
  --dim: rgba(247, 243, 232, 0.44);
  --crimson: #de4c43;
  --radius: 26px;
  --pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Fraunces", Georgia, var(--font);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", system-ui,
    "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-bot);
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(120% 70% at 50% 0%, #0f3829 0%, var(--bg-top) 48%, var(--bg-bot) 100%);
  min-height: 100dvh;
}

/* Low-opacity texture sits beneath the interactive content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- Night sky, aurora, snow ---------- */
#sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
#aurora {
  position: absolute;
  inset: -20% -30% 35% -30%;
  opacity: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(60% 50% at 30% 35%, rgba(84, 230, 174, 0.34), transparent 70%),
    radial-gradient(55% 45% at 72% 28%, rgba(110, 205, 240, 0.28), transparent 72%),
    radial-gradient(50% 40% at 52% 55%, rgba(240, 190, 91, 0.16), transparent 75%);
  filter: blur(26px);
  animation: auroraDrift 14s ease-in-out infinite alternate;
}
body.has-aurora #aurora { opacity: 1; }
@keyframes auroraDrift {
  0%   { transform: translate3d(-4%, -2%, 0) scale(1); }
  100% { transform: translate3d(4%, 3%, 0) scale(1.08); }
}
#snow { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Shell ---------- */
#app {
  position: relative;
  z-index: 1;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.ns { padding: 48px 16px; text-align: center; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
}
.brand {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62%;
}
.top-icons { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(8, 30, 22, 0.55);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  color: var(--cream);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 6px 14px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.on { color: var(--gold); border-color: rgba(240, 190, 91, 0.55); }
.icon-btn svg { width: 17px; height: 17px; }
.lang-pill {
  height: 36px;
  padding: 0 11px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: rgba(8, 30, 22, 0.55);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Hero copy ---------- */
.hero {
  text-align: center;
  margin-top: 6px;
  position: relative;
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 6.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.18;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.4);
}
.hero .sub {
  margin: 5px auto 0;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 34ch;
}
.countdown-pill {
  margin: 9px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  max-width: 100%;
  text-align: center;
  line-height: 1.35;
  border-radius: var(--pill);
  background: rgba(16, 44, 33, 0.8);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px rgba(0, 0, 0, 0.25);
  font-size: 12.5px;
  color: var(--cream);
}
.countdown-pill svg { flex: 0 0 auto; }
.countdown-pill b { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown-pill.open { background: rgba(240, 190, 91, 0.16); color: var(--gold); font-weight: 700; }
.home-urgency { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; }
.home-urgency > * { margin: 8px 0 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.home-countdown {
  padding: 5px 10px;
  border-color: rgba(222, 76, 67, .48);
  background: rgba(222, 76, 67, .13);
  color: var(--cream);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.home-countdown svg { color: var(--crimson); }
.home-builder-proof {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--cream);
  font-size: 11.5px;
  line-height: 1.35;
  animation: home-proof-in .3s var(--ease) both;
}
.builder-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #7ee2b0; }
@keyframes home-proof-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Tree stage ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 330px;
  margin: 2px 0 4px;
}
.moon {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 44px;
  height: 44px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
  filter: drop-shadow(0 0 14px rgba(255, 244, 206, 0.45));
}
body.tier-1 .moon, body.tier-2 .moon { opacity: 0.92; transform: scale(1); }

.ticker {
  position: absolute;
  top: 10px;
  left: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 6px;
  border-radius: var(--pill);
  background: rgba(12, 39, 29, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  color: var(--cream);
  max-width: 68%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  animation: tickerIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.ticker .av {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.ticker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes tickerIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tree-wrap {
  position: relative;
  width: min(100%, 348px);
  aspect-ratio: 340 / 390;
  user-select: none;
}
.tree-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.star-glow { opacity: 0.2; transition: opacity 0.7s ease; }
body.tier-1 .star-glow, body.tier-2 .star-glow {
  opacity: 1;
  animation: starPulse 2.6s ease-in-out infinite;
}
@keyframes starPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.18); opacity: 1; }
}
.garland { opacity: 0; transition: opacity 0.7s ease; }
body.tier-1 .garland, body.tier-2 .garland { opacity: 1; }
.bulb { animation: twinkle 2.4s ease-in-out infinite; }
.bulb:nth-child(2n) { animation-delay: -0.9s; }
.bulb:nth-child(3n) { animation-delay: -1.7s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

/* ---------- Gift ornaments on the tree ---------- */
.gifts-layer { position: absolute; inset: 0; pointer-events: none; }
.orn {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 54px;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  animation: swingIn 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards;
}
.orn:hover { transform: translate(-50%, -54%) scale(1.07); z-index: 4; }
.orn:active { transform: translate(-50%, -50%) scale(0.95); }
.orn.just-added { animation: popDrop 0.75s cubic-bezier(0.18, 0.9, 0.28, 1.35); z-index: 5; }
@keyframes swingIn {
  from { opacity: 0; transform: translate(-50%, -70%) scale(0.5); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes popDrop {
  0%   { opacity: 0; transform: translate(-50%, -120%) scale(0.3) rotate(-12deg); }
  65%  { opacity: 1; transform: translate(-50%, -46%) scale(1.16) rotate(5deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); }
}
.orn svg { width: 44px; height: 48px; display: block; margin: 0 auto; filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.35)); }
.orn .badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.orn.opened .badge { border-color: #7ee2b0; }
.orn.lux svg { filter: drop-shadow(0 0 10px rgba(246, 200, 96, 0.65)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.orn.crystal svg { filter: drop-shadow(0 0 11px rgba(145, 226, 255, 0.7)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.orn.aurora svg { filter: drop-shadow(0 0 12px rgba(124, 245, 196, 0.8)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.orn.legend svg { filter: drop-shadow(0 0 9px #ffe69c) drop-shadow(0 0 18px #edb956aa); }
.tree-keepsake { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 12px; font-size: 12px; color: var(--cream); }
.tree-keepsake svg { display: block; width: 24px; height: 26px; filter: drop-shadow(0 0 6px #8de4ff88); }

.pager {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 30, 22, 0.78);
  border: 1px solid var(--line-soft);
  border-radius: var(--pill);
  padding: 3px 10px;
  font-size: 12px;
  color: var(--muted);
}
.pager button { padding: 2px 6px; font-weight: 700; color: var(--gold); }

/* ---------- Progress bar ---------- */
.progress-wrap { margin: 2px 2px 10px; }
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.progress-head b { color: var(--gold); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.progress-track {
  height: 7px;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.11);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--pill);
  background: linear-gradient(90deg, #e3a73b, #f7cf73);
  transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* ---------- CTA buttons ---------- */
.actions { display: flex; flex-direction: column; gap: 9px; }
.tree-first-action { width: min(100%, 320px); margin: 14px auto 0; }
.btn-main {
  width: 100%;
  min-width: 0;
  text-align: center;
  min-height: 58px;
  padding: 10px 18px;
  border-radius: var(--pill);
  background: linear-gradient(180deg, #f5c969 0%, #e4ac3f 100%);
  color: var(--gold-ink);
  box-shadow: 0 8px 24px rgba(240, 190, 91, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.btn-main:hover { filter: brightness(1.03); }
.btn-main:active { transform: scale(0.985); }
.btn-main:disabled { opacity: 0.55; pointer-events: none; }
.btn-main .t { overflow-wrap: anywhere; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.btn-main .s { font-size: 11.5px; font-weight: 600; opacity: 0.78; display: inline-flex; align-items: center; gap: 4px; }

.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.btn-ghost {
  min-height: 44px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 8px 12px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: rgba(12, 39, 29, 0.58);
  color: var(--gold);
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  line-height: 1.2;
  transition: background 0.15s ease, transform 0.14s ease;
}
.btn-ghost:hover { background: rgba(18, 56, 42, 0.78); }
.btn-ghost:active { transform: scale(0.98); }
.btn-ghost .price-tag {
  padding: 2px 7px;
  border-radius: var(--pill);
  background: rgba(240, 190, 91, 0.18);
  font-size: 11.5px;
  font-weight: 800;
}

/* ---------- Home create card ---------- */
.create-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field {
  width: 100%;
  height: 48px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(5, 20, 15, 0.65);
  font-size: 16px;
  color: var(--cream);
  outline: none;
  transition: border-color 0.15s ease;
}
.field:focus, .area:focus { border-color: var(--gold); }
.field::placeholder, .area::placeholder { color: var(--dim); }
.area {
  width: 100%;
  min-height: 86px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(5, 20, 15, 0.65);
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.themes { display: flex; justify-content: center; gap: 10px; }
.theme-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.theme-dot.sel { border-color: var(--gold); transform: scale(1.12); box-shadow: 0 0 0 3px rgba(240, 190, 91, 0.22); }

.fine { text-align: center; font-size: 12px; color: var(--dim); margin: 2px 0 0; }
.site-identity { margin: 0; color: var(--muted); text-align: center; font-size: 11px; }
.site-identity span { color: #7ee2b0; margin-inline-end: 3px; }

/* ---------- Below-the-fold extras (owner stats, code box, footer) ---------- */
.extras {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.stat-card {
  padding: 11px 14px;
  border-radius: 16px;
  background: rgba(10, 34, 25, 0.6);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stat-card .nums { font-weight: 600; color: var(--cream); }
.link-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.text-btn { color: var(--gold); font-size: 12.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.text-btn.danger { color: #ee867e; }
.recover-tree summary { cursor: pointer; }
.recover-tree p { margin: 6px 0; }

.my-list { display: flex; flex-direction: column; gap: 6px; }
.my-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(12, 39, 29, 0.65);
  border: 1px solid var(--line-soft);
  font-weight: 600;
}
.my-item span:last-child { color: var(--gold); font-size: 13px; }

.code-bar { display: flex; gap: 7px; align-items: center; }
.code-bar .field { height: 40px; font-size: 14px; flex: 1; }
.code-bar button {
  height: 40px;
  padding: 0 15px;
  border-radius: 12px;
  background: rgba(240, 190, 91, 0.16);
  border: 1px solid var(--line);
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
}

.foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: var(--dim);
}

/* ---------- Bottom sheet modals ---------- */
#sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(2, 10, 7, 0.66);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
#sheet {
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  background: linear-gradient(158deg, #143d2fea 0%, #0a241bf5 100%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.55);
  animation: slideUp 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0.5; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (min-width: 520px) {
  #sheet-backdrop { align-items: center; padding: 20px; }
  #sheet { border-radius: 26px; border-bottom: 1px solid var(--line); }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.close-x {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--muted);
}

/* ---------- Box picker in Hang sheet ---------- */
.sec-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 0 7px; display: block; }
.box-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.box-cell {
  position: relative;
  padding: 9px 6px 7px;
  border-radius: 15px;
  border: 1.5px solid var(--line-soft);
  background: rgba(5, 20, 15, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}
.box-cell:active { transform: scale(0.96); }
.box-cell.sel {
  border-color: var(--gold);
  background: rgba(240, 190, 91, 0.13);
}
.box-cell svg { width: 38px; height: 42px; }
.box-cell .tag {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
}
.box-cell .tag.free { color: #86e3b3; }
.classic-boxes .box-cell { min-height: 46px; padding: 4px 3px; }
.classic-boxes .box-cell svg { width: 32px; height: 36px; }
.classic-boxes .tag { display: none; }
.premium-boxes .box-cell {
  justify-content: start;
  padding-inline: 3px;
  background: radial-gradient(100% 85% at 50% 12%, rgba(240, 190, 91, .14), rgba(5, 20, 15, .55));
}
.premium-boxes:has([data-box="legend"]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 350px) {
  .premium-boxes:has([data-box="legend"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.premium-boxes .box-cell[data-box="crystal"] svg { filter: drop-shadow(0 0 7px #8de4ff99); }
.premium-boxes .box-cell[data-box="aurora"] svg { filter: drop-shadow(0 0 9px #76f8bfb3); }
.premium-boxes .box-cell[data-box="gold"] svg { filter: drop-shadow(0 0 5px #edbe5b88); }
.premium-boxes .box-cell[data-box="legend"] { background: radial-gradient(100% 85% at 50% 12%, #ffe29642, #10291c); }
.premium-boxes .box-cell[data-box="legend"] svg { filter: drop-shadow(0 0 10px #ffe296c4); }
.premium-boxes .box-name { font-size: 11px; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.premium-boxes .tag { margin-top: auto; }
.gift-pick {
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  margin-bottom: 4px;
  color: #f9e7af;
  font-size: .68rem;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.box-cell .gift-pick { align-self: center; margin: 0; }
html[lang="en"] .box-cell .gift-pick { font-size: .65rem; white-space: nowrap; }
.hint-line { font-size: 11.5px; color: var(--muted); margin: 2px 0 8px; }
.premium-options { margin: 0 0 10px; }
.premium-options summary { display: list-item; cursor: pointer; padding: 5px 0; }
.gold-offer {
  display: block;
  margin-top: 5px;
  padding: 5px 0;
  min-height: 34px;
  color: var(--gold);
  font-size: 12.5px;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checks { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--cream);
  cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--gold); margin: 0; }
.char-count { text-align: right; font-size: 11px; color: var(--dim); margin-top: 3px; }

/* ---------- Note view / reveal ---------- */
.note-card {
  margin: 6px 0 14px;
  padding: 18px 16px;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(240, 190, 91, 0.14), rgba(5, 20, 15, 0.7));
  border: 1px solid var(--line);
  text-align: center;
  animation: note-reveal 360ms var(--ease) both;
}
@keyframes note-reveal {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.note-card .big-box { width: 66px; height: 72px; margin: 0 auto 8px; display: block; filter: drop-shadow(0 6px 10px #03130d99); }
.note-card .big-box svg { width: 100%; height: 100%; }
.note-card-open .big-box { margin-bottom: 14px; }
.note-card .note-body {
  max-inline-size: 32ch;
  margin: 0 auto;
  padding: clamp(13px, 5vw, 24px);
  border: 1px solid #ddbd80;
  border-radius: 11px;
  background: linear-gradient(150deg, #fff7e6, #f5e4c0);
  box-shadow: inset 0 0 0 3px #fff4db, 0 8px 20px #03130d66;
  font-family: var(--font-display);
  font-size: clamp(18px, 4.6vw, 23px);
  line-height: 1.62;
  text-align: start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #312419;
}
:lang(zh) .note-card .note-body { font-family: "Kaiti SC", "Songti SC", "Noto Serif CJK SC", var(--font); }
.note-card .locked-msg { font-size: 14px; color: var(--muted); margin: 6px 0 2px; }

/* ---------- Share grid ---------- */
.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}
.share-tile {
  padding: 12px 8px;
  border-radius: 16px;
  background: rgba(5, 20, 15, 0.55);
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cream);
}
.share-tile:active { transform: scale(0.96); }
.share-tile .ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}
.code-box {
  margin-top: 6px;
  padding: 11px 14px;
  border-radius: 15px;
  background: rgba(5, 20, 15, 0.6);
  border: 1px dashed var(--line);
  text-align: center;
}
.code-box .code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 3px 0;
}
.code-box .hint { font-size: 11.5px; color: var(--muted); }
.code-action { min-height: 32px; }
.share-recovery { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.share-recovery p { font-size: 12px; color: var(--muted); margin: 0 0 3px; }

.poster-preview {
  width: 100%;
  max-width: 270px;
  margin: 6px auto 12px;
  display: block;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ---------- Language picker ---------- */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.lang-opt {
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--line-soft);
  background: rgba(5, 20, 15, 0.45);
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
}
.lang-opt.sel { border-color: var(--gold); color: var(--gold); background: rgba(240, 190, 91, 0.12); }

/* ---------- Toast + fireworks ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 18px;
  border-radius: var(--pill);
  background: #f5c969;
  color: var(--gold-ink);
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}
.spark {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 55;
  animation: sparkFly 0.9s cubic-bezier(0.15, 0.85, 0.35, 1) forwards;
}
@keyframes sparkFly {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

@media (max-height: 700px) {
  .stage { min-height: 285px; }
  .tree-wrap { width: min(100%, 305px); }
  .hero h1 { font-size: 24px; }
  .btn-main { min-height: 52px; }
}

@media (max-width: 520px) and (max-height: 710px) {
  .stage { min-height: 0; }
  .tree-wrap { width: clamp(184px, calc(100svh - 400px), 300px); max-width: 100%; }
  .create-card { padding: 11px; gap: 8px; }
}

@media (max-width: 520px) and (max-height: 620px) {
  .orn { width: 38px; height: 42px; }
  .orn svg { width: 33px; height: 37px; }
  .orn .badge { width: 17px; height: 17px; font-size: 9px; }
  .ticker { max-width: 46%; }
  .moon { width: 33px; height: 33px; }
}

@media (max-width: 520px) and (max-height: 650px) {
  .home-stage .tree-wrap { width: clamp(156px, calc(100svh - 442px), 265px); }
  .home-stage .orn { width: 33px; height: 37px; }
  .home-stage .orn svg { width: 28px; height: 32px; }
  .home-stage .orn .badge { width: 15px; height: 15px; font-size: 8px; }
}

/* Size each gift to the tree so adjacent rows stay individually tappable. */
#tree-stage { container-type: inline-size; }
#tree-stage .orn {
  display: grid;
  place-items: center;
  width: clamp(26px, 14cqw, 50px);
  height: clamp(26px, 14cqw, 54px);
}
#tree-stage .orn svg { width: 88%; height: 92%; }
#tree-stage .orn .badge {
  width: clamp(13px, 5.8cqw, 20px);
  height: clamp(13px, 5.8cqw, 20px);
  font-size: clamp(8px, 3.2cqw, 11px);
}

.policy-page{width:min(100% - 36px,680px);margin:4rem auto;line-height:1.7}
.policy-page a{color:#ffdb92}
.policy-page h1{margin:1.4rem 0 .8rem}
.guide-page h1{font:650 clamp(2rem, 6vw, 3.2rem)/1.12 var(--font-display);text-wrap:balance}
.guide-page h2{font:650 clamp(1.3rem, 4vw, 1.7rem)/1.25 var(--font-display)}
.guide-actions{display:flex;align-items:center;flex-wrap:wrap;gap:.75rem 1rem;margin:1rem 0 1.5rem}
.guide-tool{min-height:44px;padding:5px 0;color:var(--gold);font-weight:650;text-decoration:underline;text-underline-offset:3px}
.guide-copy-status{color:var(--muted);font-size:.88rem;flex-basis:100%}
.guide-copy-status textarea{display:block;width:100%;min-height:74px;margin:6px 0 10px;padding:.6rem;background:var(--surface);border:1px solid var(--line);border-radius:8px}
.policy-page a.guide-primary{display:inline-block;padding:.55rem .95rem;border-radius:.6rem;background:#ffdb92;color:#2a1c10;font-weight:700;text-decoration:none}
.policy-page a.guide-primary:hover{background:#ffe8b9}
.policy-page a.guide-primary:focus-visible{outline:2px solid #fff;outline-offset:3px}

.pricing-page {
  position: relative;
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  padding: 28px 0 44px;
  line-height: 1.5;
}
.pricing-page a { color: var(--gold); }
.pricing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.pricing-nav div, .pricing-footer div { display: flex; gap: 12px; flex-wrap: wrap; }
.pricing-nav .pricing-brand { font: 650 1.45rem var(--font-display); text-decoration: none; }
.pricing-intro { max-width: 39rem; margin: 42px auto 34px; text-align: center; }
.pricing-intro h1 { margin: 0; font: 650 clamp(2rem, 7vw, 3.5rem)/1.07 var(--font-display); }
.pricing-intro p { margin: 14px auto 20px; max-width: 33rem; color: var(--muted); }
.pricing-intro .pricing-emotion { color: var(--cream); font: 500 clamp(1.08rem, 3.6vw, 1.35rem)/1.4 var(--font-display); margin-bottom: 0; }
.pricing-intro .btn-main {
  min-height: 48px;
  width: fit-content;
  margin: auto;
  color: var(--gold-ink);
  text-decoration: none;
  font-weight: 750;
}
.pricing-page section { margin-top: 28px; }
.pricing-page h2 { font: 600 1.45rem var(--font-display); }
.pricing-page h3 { margin: 0; font-size: 0.98rem; line-height: 1.3; overflow-wrap: anywhere; }
.pricing-gifts, .pricing-extras { margin: 0; padding: 0; list-style: none; }
.pricing-gifts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pricing-gifts li, .pricing-extras li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  min-width: 0;
}
.pricing-gifts li { display: flex; flex-direction: column; }
.pricing-gifts p, .pricing-extras p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.83rem;
}
.pricing-page strong { color: var(--gold); white-space: nowrap; }
.pricing-gifts strong { margin-top: auto; }
.pricing-art { display: grid; place-items: center; min-height: 76px; margin-bottom: 8px; }
.pricing-art svg { display: block; width: 60px; filter: drop-shadow(0 5px 5px #04120d); }
.pricing-art[data-kind="gold"] svg { filter: drop-shadow(0 0 7px #edbe5b77); }
.pricing-art[data-kind="crystal"] svg { filter: drop-shadow(0 0 11px #8de4ff88); }
.pricing-art[data-kind="aurora"] svg { filter: drop-shadow(0 0 15px #76f8bf99); }
.pricing-art[data-kind="legend"] svg { filter: drop-shadow(0 0 10px #ffe69c) drop-shadow(0 0 18px #edb95688); }
.pricing-gifts li[data-box="legend"] { background: radial-gradient(100% 85% at 50% 0, #5d5228 0%, #102c21 72%); }
.pricing-gifts li[data-box="legend"] h3,
.box-cell[data-box="legend"] .box-name { color: #ffe49d; }
@supports (background-clip: text) {
  .pricing-gifts li[data-box="legend"] h3,
  .box-cell[data-box="legend"] .box-name {
    background: linear-gradient(100deg, #ffe9a8 18%, #fffdf0 34%, #efbd65 54%, #fff8de 72%, #ffe9a8 86%) 100% 50% / 260% 100%;
    background-clip: text;
    color: transparent;
  }
  @media (prefers-reduced-motion: no-preference) {
    .pricing-gifts li[data-box="legend"] h3,
    details[open] .box-cell[data-box="legend"] .box-name { animation: legend-shine 3.2s ease-out; }
  }
}
@keyframes legend-shine { from { background-position: 0 50%; } }
.spark.reveal-spark { box-shadow: 0 0 10px #ffe3a5bb; }
@media (prefers-reduced-motion: no-preference) {
  :is(.box-cell, .pricing-gifts li) {
    position: relative;
    transition: transform 140ms ease-out;
  }
  :is(.box-cell, .pricing-gifts li)[data-card-motion] {
    transform: perspective(560px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  }
  :is(.box-cell, .pricing-gifts li)::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--shine-x, 50%) var(--shine-y, 50%), #fff3ca16, transparent 68%);
    opacity: 0;
    transition: opacity 140ms ease-out;
    pointer-events: none;
  }
  :is(.box-cell, .pricing-gifts li)[data-card-motion]::after { opacity: 1; }
}
.pricing-gifts:has([data-box="legend"]) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 640px) {
  .pricing-gifts:has([data-box="legend"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pricing-gifts li[data-box="legend"] { grid-column: 1 / -1; }
}
.pricing-extras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pricing-extras li p { margin-bottom: 0; }
.pricing-extras li strong { display: block; margin-top: 8px; }
.pricing-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.83rem; }
@media (max-width: 620px) {
  .pricing-gifts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pricing-extras { grid-template-columns: 1fr; gap: 8px; }
  .pricing-extras li { display: flex; justify-content: space-between; gap: 10px; }
  .pricing-extras li strong { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #aurora, .star-glow, .bulb, .orn, .orn.just-added, .note-card, .home-builder-proof { animation: none; }
  .spark, #snow { display: none; }
}
