/* Two in three: one celebratory ratio reveal, followed by a calm readable headline. */
body:has(.milestone-dialog[open]) { overflow: hidden; }
html:has(.milestone-dialog[open]) { overflow: hidden; scrollbar-gutter: auto; }
.milestone-dialog {
  --milestone-ink: #173d54;
  --milestone-muted: #526e79;
  box-sizing: border-box; position: fixed; inset: 0; width: 100%; height: 100%;
  width: 100dvw; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0; background: transparent; color: var(--milestone-ink);
  font-family: var(--font-body); overflow: auto; overflow-x: hidden; overscroll-behavior: contain;
}
.milestone-dialog[open] { display: flex; align-items: safe center; justify-content: center; }
.milestone-dialog::backdrop { background: rgba(14, 35, 49, .48); backdrop-filter: blur(5px); }
.milestone-dialog *, .milestone-dialog *::before, .milestone-dialog *::after { box-sizing: border-box; }
.milestone-effects, .milestone-balloons { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.milestone-card {
  flex: 0 0 auto; position: relative; width: min(660px, 100%); border-radius: 32px;
  background: #fcfefe; border: 1px solid #d8eeec;
  box-shadow: 0 28px 100px #061d3b40, inset 0 1px 0 #fff;
  text-align: center; isolation: isolate;
}
.milestone-close {
  position: absolute; z-index: 5; right: 16px; top: 16px; width: 44px; height: 44px;
  display: grid; place-items: center; padding: 0; border: 1px solid #c9e1e2;
  border-radius: 50%; background: #ffffffeb; color: #315767; cursor: pointer;
  font: 400 30px/1 var(--font-body); transition: background .15s;
}
.milestone-close:hover { background: #e3f5f1; }
.milestone-sky { height: 244px; position: relative; border-radius: 31px 31px 0 0; background: radial-gradient(ellipse at 50% 85%, #cceee6 0%, #e7f6f0 46%, #f8fcfa 78%); }
.milestone-orbit { position: absolute; width: 330px; height: 164px; left: 50%; top: 37px; transform: translateX(-50%) rotate(-12deg); border: 1px solid #88c7bf50; border-radius: 50%; }
.milestone-orbit::after { content: ""; position: absolute; inset: 18px -42px; border: 1px solid #88c7bf35; border-radius: 50%; transform: rotate(25deg); }
.milestone-stars { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; }
.milestone-star { position: absolute; display: block; width: 5px; height: 11px; background: #eda4a3; transform: rotate(25deg); border-radius: 1px; }
.milestone-star:nth-child(3n+1) { width: auto; height: auto; background: none; color: #d59b3f; font-style: normal; font-size: 22px; }
.milestone-star:nth-child(3n+2) { background: #6cbfb7; }
.milestone-star:nth-child(3n) { background: #b6a3d5; border-radius: 50%; width: 6px; height: 6px; }
.milestone-star-0 { left: 17%; top: 40px; }.milestone-star-1 { left: 29%; top: 26px; }
.milestone-star-2 { left: 38%; top: 20px; }.milestone-star-3 { left: 78%; top: 110px; }
.milestone-star-4 { left: 85%; top: 75px; }.milestone-star-5 { left: 66%; top: 38px; }
.milestone-star-6 { left: 25%; top: 153px; }.milestone-star-7 { left: 14%; top: 128px; }
.milestone-star-8 { left: 72%; top: 172px; }.milestone-star-9 { left: 69%; top: 82px; }
.milestone-star-10 { left: 37%; top: 180px; }.milestone-star-11 { left: 87%; top: 156px; }
.milestone-parade { position: absolute; inset: -25px 0 0; overflow: visible; pointer-events: none; }
.milestone-drift { position: absolute; left: 50%; bottom: -12px; width: 310px; height: 310px; transform: translateX(-50%); }
.milestone-mascot { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 8px #1b527512); }
.milestone-copy { position: relative; padding: 4px 40px 20px; border-radius: 0 0 31px 31px; background: #fcfefe; }
.milestone-eyebrow { margin: 5px 0 12px; color: #397d80; font-size: .64rem; font-weight: 800; line-height: 1.5; letter-spacing: .18em; text-transform: uppercase; }
.milestone-title { margin: 0; color: var(--milestone-ink); font-family: var(--font-body); font-weight: 800; line-height: 1; letter-spacing: -.065em; }
.milestone-number { display: block; position: relative; isolation: isolate; font-size: clamp(92px, 10vw, 130px); color: #227982; }
.milestone-number::before, .milestone-number::after { content: ""; position: absolute; z-index: -1; pointer-events: none; left: 50%; top: 50%; opacity: 0; }
.milestone-number::before { width: 3em; height: 3em; border-radius: 50%; background: repeating-conic-gradient(from 8deg, #79d9ce 0deg 5deg, transparent 5deg 28deg, #297b8e 28deg 32deg, transparent 32deg 55deg, #f4bd62 55deg 59deg, transparent 59deg 87deg); mask-image: radial-gradient(circle, transparent 39%, #000 42% 54%, transparent 57%); }
.milestone-number::after { width: 2.1em; height: 2.1em; border: 3px solid #70cabc; border-radius: 50%; box-shadow: 0 0 .16em #79d9ce66, inset 0 0 .12em #79d9ce44; }
/* Only the fixed-width digit cells move. The word “in” and all layout stay still. */
.milestone-number-current { display: inline-flex; align-items: center; gap: .11em; position: relative; white-space: nowrap; font-variant-numeric: tabular-nums; }
.milestone-digit { display: inline-grid; width: .72em; height: 1.08em; perspective: 600px; }
.milestone-digit > span { display: block; grid-area: 1 / 1; line-height: 1.08; backface-visibility: hidden; transform-origin: 50% 55%; }
.milestone-ratio-in { color: var(--milestone-ink); font-size: .43em; font-weight: 650; line-height: 1; letter-spacing: -.025em; }
.milestone-number-previous { opacity: 0; visibility: hidden; }
.milestone-digit-final { opacity: 1; text-shadow: 0 0 .22em #43bda826; }
.milestone-number-burst { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
.milestone-burst-bit { position: absolute; left: 50%; top: 50%; width: .055em; height: .105em; opacity: 0; border-radius: 1px; background: #79d9ce; }
.milestone-burst-bit:nth-child(4n+2) { background: #f4bd62; }
.milestone-burst-bit:nth-child(4n+3) { background: #1c526a; }
.milestone-burst-bit:nth-child(4n) { background: #38aaa7; }
.milestone-burst-bit:nth-child(3n) { width: .09em; height: .09em; clip-path: polygon(50% 0, 64% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0 50%, 36% 36%); }
@media (prefers-reduced-motion: no-preference) {
  .milestone-dialog:not(.milestone-motion-stopped) .milestone-number-previous { animation: milestone-number-roll-out 3s cubic-bezier(.22, 1, .36, 1) both; }
  .milestone-dialog:not(.milestone-motion-stopped) .milestone-digit-final { animation: milestone-number-roll-in 3s ease-in-out both; }
  .milestone-dialog:not(.milestone-motion-stopped) .milestone-number::before { animation: milestone-color-burst 1.65s ease-out 1.12s both; }
  .milestone-dialog:not(.milestone-motion-stopped) .milestone-number::after { animation: milestone-color-ring 1.55s ease-out 1.18s both; }
  .milestone-dialog:not(.milestone-motion-stopped) .milestone-burst-bit { animation: milestone-confetti-burst 1.65s cubic-bezier(.16,.68,.3,1) 1.2s both; }
}
@keyframes milestone-color-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.32) rotate(-18deg); }
  28% { opacity: .95; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.15) rotate(15deg); }
}
@keyframes milestone-color-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
  20% { opacity: .8; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); }
}
@keyframes milestone-confetti-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0); }
  15% { opacity: 1; }
  70% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--burst-x), var(--burst-y)) scale(1) rotate(var(--burst-spin)); }
}
@keyframes milestone-number-roll-out {
  0%, 32% { opacity: 1; visibility: visible; transform: translateY(0) rotateX(0); }
  57%, 100% { opacity: 0; visibility: hidden; transform: translateY(-.55em) rotateX(-110deg); }
}
@keyframes milestone-number-roll-in {
  0%, 32% { opacity: 0; transform: translateY(.55em) rotateX(110deg) scale(.88); }
  60% { opacity: 1; transform: translateY(-.04em) rotateX(0) scale(1.16); text-shadow: 0 0 .2em #43cdb5a6, 0 0 .48em #43cdb570; }
  74% { opacity: 1; transform: translateY(.015em) rotateX(0) scale(.96); }
  86% { opacity: 1; transform: translateY(0) rotateX(0) scale(1.035); }
  100% { opacity: 1; transform: translateY(0) rotateX(0) scale(1); text-shadow: 0 0 .22em #43bda826; }
}
.milestone-title-line { display: block; margin-top: 8px; font-size: 38px; line-height: 1.16; letter-spacing: -.047em; }
.milestone-message { max-width: 460px; margin: 18px auto 20px; color: var(--milestone-muted); font-size: .91rem; line-height: 1.75; }
.milestone-continue { width: min(340px, 100%); min-height: 52px; display: inline-flex; justify-content: center; align-items: center; gap: 20px; border: 1px solid #25737d; padding: 13px 20px; border-radius: 14px; background: linear-gradient(145deg, #318b8e, #226c78); box-shadow: inset 0 1px 0 #ffffff30, 0 6px 16px #287c8321; color: #fff; font: 750 .9rem/1.5 var(--font-body); cursor: pointer; }
.milestone-continue:hover { background: #206874; }
.milestone-continue > span { font-size: 22px; font-weight: 400; }
.milestone-animation-toggle { display: block; width: fit-content; min-height: 44px; margin: 4px auto 0; padding: 8px 16px; border: 0; border-radius: 8px; background: transparent; color: var(--milestone-muted); font: 600 .72rem/1.4 var(--font-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.milestone-animation-toggle:hover { color: var(--milestone-ink); background: #77c9bc15; }
.milestone-animation-toggle:disabled { text-decoration: none; cursor: default; }
.milestone-preference { width: fit-content; max-width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 auto; padding: 6px; color: var(--milestone-muted); font-size: .76rem; line-height: 1.5; cursor: pointer; }
.milestone-preference input { appearance: auto; width: 17px; height: 17px; flex-shrink: 0; margin: 0; accent-color: #287c83; cursor: pointer; }
.milestone-dialog :is(button, input):focus-visible { outline: 3px solid #bb8329; outline-offset: 4px; }
.milestone-title:focus { outline: none; }
.milestone-balloon { position: absolute; bottom: -180px; width: 57px; height: 72px; border-radius: 49% 49% 47% 47%; background: radial-gradient(circle at 30% 25%, #e3fbef, #7bd0bf 35%, #329989 88%); box-shadow: inset -8px -10px 15px #133e4829; animation: milestone-float 9s ease-out both; }
.milestone-balloon::before { content: ""; position: absolute; top: 70px; left: 24px; width: 9px; height: 7px; background: inherit; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.milestone-balloon::after { content: ""; position: absolute; left: 28px; top: 77px; width: 14px; height: 90px; border-left: 1px solid #ebf4efa1; border-radius: 50%; transform: rotate(6deg); }
.milestone-balloon-0 { left: 7%; animation-delay: .3s; }
.milestone-balloon-1 { right: 9%; animation-delay: 1s; background: radial-gradient(circle at 30% 25%, #fff0d4, #efc27d 35%, #c89758 88%); }
.milestone-balloon-2 { left: 18%; animation-delay: 1.7s; width: 44px; height: 60px; background: radial-gradient(circle at 30% 25%, #e9e2fb, #b2a0d6 35%, #8473ac 88%); }
.milestone-balloon-3 { right: 20%; animation-delay: .7s; width: 48px; height: 63px; background: radial-gradient(circle at 30% 25%, #ffe5e1, #edaa9f 35%, #c78084 88%); }
.milestone-settled .milestone-balloons { display: none; }
.milestone-settled :is(.milestone-drift, .milestone-mascot) { animation: none; }
.milestone-save-notice { position: fixed; z-index: 10000; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); padding: 14px 18px; border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg); font: .8rem/1.6 var(--font-body); }
.milestone-save-notice button { display: block; min-height: 44px; padding: 8px 0; border: 0; background: transparent; color: var(--color-accent-strong); font: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; }
@keyframes milestone-float { from { transform: translate(0, 0) rotate(-7deg); } to { transform: translate(35px, calc(-100dvh - 180px)) rotate(8deg); } }
:root[data-theme="dark"] .milestone-dialog, body.theme-dark .milestone-dialog { --milestone-ink: #e1f5f3; --milestone-muted: #a9c8cb; }
:root[data-theme="dark"] .milestone-card, body.theme-dark .milestone-card { background: #16313c; border-color: #33565f; box-shadow: 0 28px 100px #0007, inset 0 1px 0 #ffffff10; }
:root[data-theme="dark"] .milestone-sky, body.theme-dark .milestone-sky { background: radial-gradient(ellipse at 50% 85%, #244f54, #183b45 55%, #16313c 85%); }
:root[data-theme="dark"] .milestone-copy, body.theme-dark .milestone-copy { background: #16313c; }
:root[data-theme="dark"] :is(.milestone-number, .milestone-eyebrow), body.theme-dark :is(.milestone-number, .milestone-eyebrow) { color: #82d6c9; }
@media (max-width: 600px) {
  .milestone-dialog { padding: 18px 14px; }
  .milestone-card { border-radius: 25px; }
  .milestone-sky { height: 222px; border-radius: 24px 24px 0 0; }
  .milestone-drift { width: 282px; height: 282px; }
  .milestone-orbit { width: 220px; height: 145px; top: 22px; }
  .milestone-close { top: 11px; right: 11px; }
  .milestone-copy { padding: 4px 20px 14px; border-radius: 0 0 24px 24px; }
  .milestone-eyebrow { font-size: .55rem; letter-spacing: .14em; margin-bottom: 10px; }
  .milestone-number { font-size: 96px; }
  .milestone-title-line { font-size: clamp(22px, 6.6vw, 32px); margin-top: 8px; }
  .milestone-message { font-size: .86rem; margin: 16px auto 18px; line-height: 1.7; }
  .milestone-preference { font-size: .75rem; margin-top: 0; }
}
@media (max-height: 720px) {
  .milestone-sky { height: 190px; }
  .milestone-drift { width: 218px; height: 218px; }
  .milestone-number { font-size: 96px; }
  .milestone-title-line { font-size: clamp(22px, 6.6vw, 29px); }
  .milestone-message { margin-top: 12px; margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .milestone-dialog *, .milestone-dialog *::before, .milestone-dialog *::after { animation: none !important; transition: none !important; }
  .milestone-effects, .milestone-balloons { display: none; }
}
