:root {
  --bg: #07060f;
  --fg: #f3f0ff;
  --muted: #a39fc0;
  --card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --a1: #ff7ab6;
  --a2: #ffb86b;
  --a3: #8a7dff;
  --grad: linear-gradient(100deg, var(--a1), var(--a2) 50%, var(--a3));
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -10%, #1d1440 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

#stars, #confetti {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
#stars { z-index: 0; }
#confetti { z-index: 50; }

main, footer { position: relative; z-index: 1; }

section {
  max-width: 980px;
  margin: 0 auto;
  padding: 96px 16px;
  text-align: center;
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
h3 { margin: 48px 0 16px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- HERO ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding-top: 0; padding-bottom: 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}
.date {
  font-family: var(--mono);
  font-size: clamp(3rem, 14vw, 9rem);
  font-weight: 700;
  margin: 12px 0;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.date span {
  display: inline-block;
  background: var(--grad);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: rise 0.9s cubic-bezier(.2,.9,.3,1.4) both, shimmer 8s linear infinite;
}
.date .dot { opacity: 0.6; margin: 0 -0.12em; }
.date span:hover { transform: translateY(-6px) rotate(-4deg); transition: transform .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(.8); } }
@keyframes shimmer { to { background-position: 300% 0; } }

.tagline { font-size: clamp(1rem, 2.5vw, 1.3rem); color: var(--muted); margin: 8px 0 0; font-weight: 300; }

.bday-banner {
  margin-top: 28px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--grad);
  color: #1a0b1f;
  font-weight: 600;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.04); } }

.scroll-hint {
  position: absolute; bottom: 28px;
  color: var(--muted); text-decoration: none; font-size: 1.4rem;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(8px); } }

/* ---------- CLOCKS ---------- */
.clock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin: 32px auto 16px;
  max-width: 820px;
}
.clock > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 8px;
  backdrop-filter: blur(6px);
}
.clock b {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-variant-numeric: tabular-nums;
}
.clock span { color: var(--muted); font-size: 0.85rem; }
.clock--accent b {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.big-number {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 4.5vw, 2.2rem);
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.big-number small { color: var(--muted); font-size: 0.55em; }

.progress {
  height: 8px; max-width: 820px; margin: 8px auto 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden;
}
.progress > div { height: 100%; width: 0; background: var(--grad); border-radius: inherit; }

/* ---------- STAT CARDS ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 32px;
  text-align: left;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  transition: transform .25s, border-color .25s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(255,122,182,.4); }
.card .icon { font-size: 1.6rem; }
.card .val {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.card .lbl { color: var(--muted); font-size: 0.85rem; }

/* ---------- PLANETS ---------- */
.planets { display: grid; gap: 14px; margin-top: 32px; text-align: left; }
.planet {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 4px 14px;
  align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 18px;
}
.planet .orb { width: 36px; height: 36px; border-radius: 50%; grid-row: span 2; box-shadow: inset -8px -6px 12px rgba(0,0,0,.45); }
.planet .name { font-weight: 600; }
.planet .age { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; text-align: right; }
.planet .bar { grid-column: 2 / 4; height: 6px; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; }
.planet .bar > div { height: 100%; background: var(--grad); }
.planet .next { grid-column: 2 / 4; color: var(--muted); font-size: 0.8rem; }

/* ---------- WEEKS ---------- */
.weeks-wrap { margin: 28px auto 12px; max-width: 760px; }
.weeks {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
}
.weeks i {
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(255,255,255,.07);
}
.weeks i.lived { background: var(--a3); opacity: .85; }
.weeks i.decade { box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.weeks i.now { background: var(--a1); animation: blink 1s steps(2) infinite; transform: scale(1.6); border-radius: 50%; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- TIMELINE ---------- */
.timeline {
  list-style: none; padding: 0; margin: 32px auto 0;
  max-width: 640px; text-align: left;
  position: relative;
}
.timeline::before {
  content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline li { position: relative; padding: 0 0 22px 40px; }
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--muted);
}
.timeline li.past::before { background: var(--a3); border-color: var(--a3); }
.timeline li.next::before { background: var(--a1); border-color: var(--a1); box-shadow: 0 0 0 6px rgba(255,122,182,.2); }
.timeline li.past { opacity: .6; }
.timeline .t-label { font-weight: 600; }
.timeline .t-date { color: var(--muted); font-size: .85rem; font-family: var(--mono); }
.timeline .t-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  border-radius: 999px; font-size: .75rem;
  background: rgba(255,122,182,.15); color: var(--a1);
}

/* ---------- FACTS ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-top: 32px;
}
.fact { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.fact .k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }
.fact .v { font-weight: 600; font-size: 1.1rem; margin-top: 4px; }
.world { list-style: none; padding: 0; max-width: 640px; margin: 0 auto; text-align: left; }
.world li { padding: 10px 0; border-bottom: 1px dashed var(--border); }

/* ---------- CAKE ---------- */
.cake {
  position: relative;
  width: min(340px, 100%);
  margin: 72px auto 24px;
  display: flex; flex-direction: column; align-items: center;
}
.candles {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 10px 8px;
  width: 78%;
  margin-bottom: -4px;
  position: relative; z-index: 2;
}
.candle {
  position: relative;
  width: 8px; height: 34px;
  border-radius: 2px;
  background: repeating-linear-gradient(45deg, #fff 0 5px, var(--a1) 5px 10px);
  cursor: pointer;
  border: 0; padding: 0;
}
.candle::before { /* wick */
  content: ""; position: absolute; left: 3px; top: -6px;
  width: 2px; height: 6px; background: #333;
}
.candle .flame {
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  width: 10px; height: 16px; margin-left: -5px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff 0 20%, #ffd36b 40%, #ff7a2e 75%, transparent 76%);
  box-shadow: 0 0 14px 4px rgba(255, 170, 60, .55);
  animation: flicker .12s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
  transition: opacity .25s, transform .25s;
}
@keyframes flicker { to { transform: rotate(3deg) scaleY(1.08); } }
.candle.out .flame { opacity: 0; transform: scale(.2); animation: none; }
.candle .smoke {
  position: absolute; left: 50%; bottom: 100%;
  width: 6px; height: 6px; margin-left: -3px;
  border-radius: 50%; background: rgba(200,200,220,.6);
  opacity: 0; pointer-events: none;
}
.candle.out .smoke { animation: smoke 1.4s ease-out forwards; }
@keyframes smoke {
  0% { opacity: .8; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) translateX(8px) scale(4); }
}

.layer { width: 100%; border-radius: 12px; position: relative; }
.layer--top { height: 22px; width: 86%; background: #ffe9f2; border-radius: 12px 12px 4px 4px; box-shadow: 0 6px 0 -2px #ffc2dc; }
.layer--mid {
  height: 70px; width: 92%; margin-top: 2px;
  background: linear-gradient(#ff9cc8, #f06aa6);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; color: #fff; letter-spacing: .1em;
}
.layer--bot { height: 64px; background: linear-gradient(#8a7dff, #6252e0); margin-top: 2px; }
.plate { width: 118%; height: 14px; border-radius: 50%; background: rgba(255,255,255,.18); margin-top: -4px; }

.wish {
  font-size: 1.3rem; font-weight: 600;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rise .8s both;
}
.buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
button {
  font: inherit; font-weight: 600;
  padding: 10px 20px; border-radius: 999px;
  border: 0; cursor: pointer;
  background: var(--grad); color: #1a0b1f;
  transition: transform .15s;
}
button:hover { transform: translateY(-2px); }
button.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
button.listening { animation: pulse 1s infinite; }

/* ---------- FOOTER ---------- */
footer { text-align: center; padding: 48px 16px 64px; color: var(--muted); }
footer p { margin: 4px 0; }
kbd {
  font-family: var(--mono); padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
}

/* ---------- REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .9s, transform .9s; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 520px) {
  section { padding: 72px 16px; }
  .clock { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  #cd-clock { grid-template-columns: repeat(2, 1fr); }
  .weeks { gap: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
