:root {
  --night0: #05051a; --night1: #13123d; --ink: #f6f3ea; --muted: rgba(226, 228, 255, .66);
  --gold: #f6d58a; --gold2: #fff3cf; --line: rgba(226, 228, 255, .16); --glass: rgba(226, 228, 255, .07);
  --serif: "Fraunces", Georgia, serif; --sans: "Inter", system-ui, sans-serif; --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night0); }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100dvh; overflow: hidden; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1100px 700px at 50% 0%, #2b2470 0%, transparent 62%), radial-gradient(800px 500px at 85% 30%, rgba(255, 110, 170, .14), transparent 60%), linear-gradient(180deg, var(--night1), var(--night0) 75%);
  display: flex; flex-direction: column;
}
button, input, textarea { font: inherit; color: inherit; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
#city, #fx { pointer-events: none; }
#sky { cursor: crosshair; }

.counting .card { opacity: .18; filter: blur(2px); }
.card { transition: opacity .5s, filter .5s; }
.card { position: relative; z-index: 2; margin: auto; padding: max(24px, env(safe-area-inset-top)) 24px 120px; text-align: center; pointer-events: none; }
.card > * { pointer-events: auto; }
.dear { margin: 0 0 6px; font: italic 400 clamp(18px, 2vw, 24px) var(--serif); color: var(--gold2); opacity: 0; animation: rise 1s var(--ease) .2s forwards; }
.title { margin: 0; font: 400 clamp(40px, 7vw, 96px)/.95 var(--serif); letter-spacing: -.02em; font-variation-settings: "opsz" 144; }
.title span { display: inline-block; opacity: 0; animation: rise 1.1s var(--ease) forwards; }
.title .t1 { font-style: italic; font-weight: 300; color: var(--gold2); animation-delay: .35s; }
.title .t2 { animation-delay: .5s; }
.year { display: flex; justify-content: center; gap: .02em; margin: 6px 0 0; font: 600 clamp(84px, 17vw, 220px)/1 var(--serif); font-variant-numeric: lining-nums; letter-spacing: -.03em;
  background: linear-gradient(180deg, #fff6d8 10%, var(--gold) 55%, #c98f3a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 30px rgba(246, 213, 138, .35)); opacity: 0; animation: rise 1.2s var(--ease) .65s forwards; perspective: 600px; }
.year .d { display: inline-block; position: relative; }
.year .d.flip { animation: flip .9s var(--ease); }
@keyframes flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg); opacity: .2; } 55% { transform: rotateX(-90deg); opacity: .2; } 100% { transform: rotateX(0); } }
.wish { min-height: 1.5em; margin: 6px 0 0; font: italic 400 clamp(16px, 1.8vw, 21px)/1.4 var(--serif); color: var(--muted); transition: opacity .6s, transform .6s var(--ease); }
.wish.out { opacity: 0; transform: translateY(6px); }
.chip { display: inline-flex; gap: 8px; align-items: center; margin: 16px 0 0; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.msg { max-width: 30em; margin: 18px auto 0; font: italic 400 clamp(17px, 1.9vw, 22px)/1.5 var(--serif); color: var(--gold2); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; opacity: 0; animation: rise 1s var(--ease) 1s forwards; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 600; font-size: 15px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); transition: transform .15s, background .2s; }
.btn:hover { background: rgba(226, 228, 255, .13); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.primary { border: 0; color: #2a1d05; background: linear-gradient(180deg, #ffe9b0, var(--gold)); box-shadow: 0 10px 30px -10px rgba(246, 213, 138, .8); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.count { position: fixed; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; font: 600 clamp(160px, 38vw, 420px)/1 var(--serif); color: var(--gold2);
  text-shadow: 0 0 60px rgba(246, 213, 138, .6); background: radial-gradient(closest-side, rgba(5, 5, 26, .55), transparent); }
.count.tick { animation: pulse .9s var(--ease); }
@keyframes pulse { from { transform: scale(1.35); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: .9; } }

.sheet { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: rgba(19, 18, 61, .92); backdrop-filter: blur(16px); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.sheet::backdrop { background: rgba(3, 3, 15, .6); backdrop-filter: blur(4px); }
.sheet form { display: grid; gap: 12px; padding: 22px; }
.sheet h2 { margin: 0 0 4px; font: 400 26px var(--serif); }
.sheet label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.sheet input, .sheet textarea { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink); resize: vertical; outline: none; }
.sheet input:focus, .sheet textarea:focus { border-color: var(--gold); }
.sheet .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.sheet .btn { height: 42px; padding: 0 16px; font-size: 14px; }
.hint { margin: 0; min-height: 1.2em; font-size: 13px; color: var(--gold); }

.foot { position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 2; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; }
.foot a { color: var(--ink); pointer-events: auto; }

@media (max-width: 520px) { .card { padding-bottom: 150px; } .btn { height: 44px; padding: 0 16px; font-size: 14px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
