:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #65717d;
  --paper: #fffefd;
  --aqua: #1a9aa2;
  --aqua-dark: #08747f;
  --coral: #e85d4f;
  --gold: #efb63e;
  --leaf: #4b9c67;
  --sky: #2d6cdf;
  --berry: #9d4b78;
  --pink: #ff7aa8;
  --lemon: #ffe071;
  --lavender: #b987ff;
  --mint: #7ee2b8;
  --line: rgba(23, 32, 42, 0.13);
  --shadow: 0 16px 34px rgba(118, 74, 46, 0.12);
  --font-sans: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 7%, rgba(255, 122, 168, 0.34), transparent 22%),
    radial-gradient(circle at 88% 4%, rgba(126, 226, 184, 0.34), transparent 24%),
    radial-gradient(circle at 58% 108%, rgba(255, 224, 113, 0.44), transparent 34%),
    linear-gradient(135deg, #fff8f0 0%, #fff4fb 32%, #effaf7 68%, #fff3c8 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(232, 93, 79, 0.52) 0 2px, transparent 2.6px),
    radial-gradient(circle, rgba(45, 108, 223, 0.4) 0 2px, transparent 2.6px),
    linear-gradient(45deg, transparent 44%, rgba(239, 182, 62, 0.44) 45% 55%, transparent 56%),
    linear-gradient(-35deg, transparent 45%, rgba(157, 75, 120, 0.34) 46% 55%, transparent 56%);
  background-position: 4% 12%, 92% 19%, 17% 84%, 82% 76%;
  background-size: 74px 74px, 92px 92px, 120px 120px, 106px 106px;
  opacity: 0.72;
}

button,
input {
  font: inherit;
}

.party-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.balloon,
.cake,
.garland,
.party-sprinkle {
  position: absolute;
  display: block;
}

.balloon {
  width: clamp(44px, 5vw, 76px);
  aspect-ratio: 0.82;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.76) 0 12%, transparent 13%),
    linear-gradient(145deg, var(--balloon-a), var(--balloon-b));
  box-shadow: inset -8px -14px 20px rgba(128, 48, 81, 0.12), 0 18px 34px rgba(92, 50, 65, 0.12);
}

.balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 10px;
  background: var(--balloon-b);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  transform: translateX(-50%);
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  width: 1px;
  height: 92px;
  background: linear-gradient(rgba(23, 32, 42, 0.2), transparent);
}

.balloon-a {
  --balloon-a: #ff9fc0;
  --balloon-b: #e85d4f;
  left: max(18px, 2.6vw);
  top: 10vh;
  transform: rotate(-8deg);
}

.balloon-b {
  --balloon-a: #ffe28a;
  --balloon-b: #efb63e;
  right: max(22px, 3vw);
  top: 9vh;
  transform: rotate(7deg);
}

.balloon-c {
  --balloon-a: #91f0d3;
  --balloon-b: #1a9aa2;
  right: 10vw;
  bottom: 16vh;
  width: clamp(34px, 4vw, 58px);
  transform: rotate(-10deg);
}

.garland {
  top: 0;
  width: min(420px, 42vw);
  height: 82px;
  opacity: 0.76;
}

.garland::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 24px;
  height: 42px;
  border-top: 3px solid rgba(23, 32, 42, 0.12);
  border-radius: 50%;
}

.garland::after {
  content: "";
  position: absolute;
  inset: 32px 8px auto;
  height: 30px;
  background:
    conic-gradient(from 45deg, var(--pink) 0 25%, transparent 0) 0 0 / 34px 30px repeat-x,
    conic-gradient(from 45deg, var(--gold) 0 25%, transparent 0) 17px 0 / 34px 30px repeat-x;
}

.garland-left {
  left: -26px;
  transform: rotate(-4deg);
}

.garland-right {
  right: -20px;
  transform: rotate(4deg);
}

.cake {
  right: clamp(22px, 4vw, 72px);
  bottom: clamp(22px, 5vh, 54px);
  width: clamp(70px, 8vw, 112px);
  height: clamp(52px, 6vw, 78px);
  border-radius: 14px 14px 12px 12px;
  background:
    radial-gradient(circle at 25% 24%, #fff6fd 0 8%, transparent 9%),
    radial-gradient(circle at 52% 24%, #fff6fd 0 8%, transparent 9%),
    radial-gradient(circle at 78% 24%, #fff6fd 0 8%, transparent 9%),
    linear-gradient(#ff8cb7 0 38%, #ffe071 38% 58%, #f36b5c 58% 100%);
  box-shadow: 0 18px 34px rgba(118, 74, 46, 0.14);
}

.cake::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: -12px;
  height: 16px;
  background:
    linear-gradient(90deg, transparent 0 16%, #1a9aa2 16% 21%, transparent 21% 46%, #9d4b78 46% 51%, transparent 51% 76%, #e85d4f 76% 81%, transparent 81%),
    radial-gradient(circle at 18% 0, #ffe071 0 5px, transparent 6px),
    radial-gradient(circle at 49% 0, #ffe071 0 5px, transparent 6px),
    radial-gradient(circle at 79% 0, #ffe071 0 5px, transparent 6px);
}

.cake::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.party-sprinkle {
  width: 44px;
  height: 12px;
  border-radius: 999px;
  opacity: 0.56;
  transform: rotate(var(--spin));
}

.sprinkle-a {
  --spin: 22deg;
  left: 18vw;
  top: 18vh;
  background: var(--lavender);
}

.sprinkle-b {
  --spin: -18deg;
  left: 8vw;
  bottom: 24vh;
  background: var(--mint);
}

.sprinkle-c {
  --spin: 34deg;
  right: 22vw;
  top: 17vh;
  background: var(--coral);
}

.sprinkle-d {
  --spin: -28deg;
  right: 18vw;
  bottom: 10vh;
  background: var(--gold);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: clamp(7px, 1vh, 12px);
  width: min(1560px, calc(100% - 16px));
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(7px, 1.1vh, 14px) 0;
}

.control-bar,
.event-panel,
.moment-strip,
.metric-card,
.timeline-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.control-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 0.48fr) minmax(560px, 1.52fr);
  gap: clamp(12px, 2vw, 24px);
  align-items: end;
  padding: clamp(10px, 1.5vh, 16px);
  overflow: hidden;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.92), rgba(255, 246, 231, 0.8)),
    radial-gradient(circle at 14% 15%, rgba(255, 122, 168, 0.2), transparent 34%),
    radial-gradient(circle at 88% 10%, rgba(126, 226, 184, 0.22), transparent 30%);
}

.control-bar::after {
  content: "";
  position: absolute;
  right: clamp(16px, 2.4vw, 38px);
  top: -26px;
  z-index: 0;
  width: clamp(84px, 8vw, 128px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 52% 42%, transparent 0 34%, rgba(255, 255, 255, 0.78) 35% 43%, transparent 44%),
    conic-gradient(from 12deg, #ff7aa8, #ffe071, #7ee2b8, #b987ff, #ff7aa8);
  opacity: 0.38;
  pointer-events: none;
  transform: rotate(16deg);
}

.control-bar > * {
  position: relative;
  z-index: 1;
}

.intro {
  min-width: 0;
}

.eyebrow,
.label,
.mini-label {
  margin: 0;
  color: var(--aqua-dark);
  font-size: clamp(0.58rem, 0.72vw, 0.7rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 4px 0 0;
  max-width: 450px;
  font-size: clamp(1.35rem, 1.82vw, 2.08rem);
  font-weight: 800;
  line-height: 1.02;
  text-wrap: balance;
}

.intro h1 {
  background: linear-gradient(115deg, #17202a 0%, #d94f79 48%, #08747f 100%);
  background-clip: text;
  color: transparent;
}

.date-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(150px, 0.95fr) minmax(110px, 0.65fr) auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: clamp(0.62rem, 0.68vw, 0.7rem);
  font-weight: 700;
}

input:not([type="checkbox"]):not([type="range"]) {
  width: 100%;
  min-height: clamp(34px, 4.2vh, 40px);
  border: 1px solid rgba(23, 32, 42, 0.15);
  border-radius: 8px;
  background: #fffefd;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  font-size: clamp(0.78rem, 0.86vw, 0.9rem);
  font-weight: 700;
}

input:not([type="checkbox"]):not([type="range"]):focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 4px rgba(26, 154, 162, 0.14);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: clamp(34px, 4.2vh, 40px);
  min-width: 104px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #17202a, #25364a);
  color: #fffaf3;
  cursor: pointer;
  font-size: clamp(0.78rem, 0.86vw, 0.9rem);
  font-weight: 800;
}

button:hover {
  background: linear-gradient(135deg, #263442, #17202a);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-icon {
  width: 16px;
  height: 16px;
  background:
    linear-gradient(#fffaf3, #fffaf3) center / 100% 3px no-repeat,
    linear-gradient(#fffaf3, #fffaf3) center / 3px 100% no-repeat;
  border-radius: 50%;
}

.event-panel {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: clamp(9px, 1.25vh, 13px) clamp(12px, 1.8vw, 18px);
}

.event-panel-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.event-panel-heading strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.1;
}

.selection-actions {
  display: flex;
  gap: 6px;
}

.ghost-button,
.event-remove {
  min-width: 0;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(23, 32, 42, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.ghost-button:hover,
.event-remove:hover {
  background: #fffefd;
}

.event-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 230px);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.share-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(232, 93, 79, 0.22);
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  background: #fff6e7;
}

.share-panel[hidden] {
  display: none;
}

.share-panel p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.66rem, 0.74vw, 0.74rem);
  font-weight: 700;
  line-height: 1.35;
}

.share-panel strong {
  color: var(--ink);
  font-weight: 800;
}

.share-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

#share-url {
  min-height: 34px;
  font-size: clamp(0.66rem, 0.74vw, 0.74rem);
}

#copy-share {
  min-width: 94px;
}

#share-status {
  min-height: 1em;
  color: var(--aqua-dark);
  font-size: clamp(0.62rem, 0.7vw, 0.7rem);
  font-weight: 800;
}

.feedback-fab {
  position: fixed;
  right: clamp(14px, 2vw, 28px);
  bottom: clamp(14px, 2vw, 28px);
  z-index: 50;
  min-width: 0;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--coral), var(--berry));
  box-shadow: 0 16px 32px rgba(118, 74, 46, 0.2);
}

.feedback-fab:hover {
  background: linear-gradient(135deg, #cf4d74, #7f3d65);
}

.feedback-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 32, 42, 0.36);
  backdrop-filter: blur(10px);
}

.feedback-dialog[hidden] {
  display: none;
}

.feedback-card {
  width: min(500px, 100%);
  padding: clamp(16px, 2.3vw, 22px);
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 224, 113, 0.36), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(255, 122, 168, 0.28), transparent 32%),
    #fffefd;
  box-shadow: 0 28px 70px rgba(23, 32, 42, 0.24);
}

.feedback-header {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.feedback-header h2 {
  margin: 3px 0 0;
  font-size: clamp(1.3rem, 2.1vw, 1.8rem);
  line-height: 1;
}

.feedback-close {
  width: 36px;
  min-width: 36px;
  padding: 0;
  border: 1px solid rgba(23, 32, 42, 0.14);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.feedback-close:hover {
  background: #fffefd;
  color: var(--ink);
}

.feedback-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.feedback-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.feedback-form textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid rgba(23, 32, 42, 0.15);
  border-radius: 8px;
  background: #fffefd;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.feedback-form textarea:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 4px rgba(26, 154, 162, 0.14);
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.feedback-actions a {
  color: var(--aqua-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#feedback-status {
  min-height: 1em;
  color: var(--aqua-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.bot-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.event-card {
  --accent: var(--aqua);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.event-card:not(.selected) {
  opacity: 0.58;
}

.event-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.event-meta {
  min-width: 0;
}

.event-name,
.event-age,
.event-date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-name {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.event-age,
.event-date {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.event-remove {
  width: 30px;
  padding: 0;
  color: var(--muted);
}

.moment-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 330px);
  gap: 16px;
  align-items: center;
  padding: clamp(10px, 1.5vh, 16px) clamp(14px, 2vw, 24px);
}

.moment-strip h2,
.section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(1.1rem, 1.8vw, 1.85rem);
  line-height: 1.04;
  text-wrap: balance;
}

.next-toast {
  min-width: 0;
  padding: clamp(10px, 1.4vh, 14px) 15px;
  border-left: 5px solid var(--coral);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #fff6e7, #fff0f6),
    radial-gradient(circle at 90% 12%, rgba(255, 122, 168, 0.24), transparent 28%);
}

.next-toast strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: clamp(0.78rem, 0.92vw, 0.9rem);
  line-height: 1.16;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(8px, 1vw, 12px);
}

.metric-card {
  min-width: 0;
  min-height: clamp(70px, 9vh, 90px);
  padding: clamp(8px, 1.1vh, 12px);
  border-top: 5px solid var(--accent, var(--aqua));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 252, 247, 0.88)),
    radial-gradient(circle at 90% 0%, rgba(255, 224, 113, 0.22), transparent 34%);
  box-shadow: 0 10px 24px rgba(118, 74, 46, 0.08);
}

.metric-years {
  --accent: var(--aqua);
}

.metric-months {
  --accent: var(--coral);
}

.metric-weeks {
  --accent: var(--gold);
}

.metric-days {
  --accent: var(--leaf);
}

.metric-hours {
  --accent: var(--sky);
}

.metric-minutes {
  --accent: var(--berry);
}

.metric-seconds {
  --accent: var(--ink);
}

.metric-unit {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.62rem, 0.72vw, 0.76rem);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value {
  display: block;
  margin-top: clamp(5px, 0.85vh, 8px);
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.18rem, 1.55vw, 1.78rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.95;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-note {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.54rem, 0.62vw, 0.62rem);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: clamp(10px, 1.5vh, 16px) clamp(14px, 2vw, 24px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 253, 248, 0.84)),
    radial-gradient(circle at 12% 100%, rgba(255, 122, 168, 0.18), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(126, 226, 184, 0.18), transparent 24%);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(8px, 1.4vh, 14px);
}

.section-heading h2 {
  font-size: clamp(1.08rem, 1.58vw, 1.62rem);
}

#timeline-range {
  display: block;
  color: var(--muted);
  font-size: clamp(0.68rem, 0.86vw, 0.78rem);
  font-weight: 700;
  text-align: right;
}

.milestone-settings {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(150px, 220px);
  gap: 7px 12px;
  align-items: center;
  justify-items: end;
  min-width: min(100%, 390px);
}

.milestone-settings strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.84rem;
}

.milestone-settings input[type="range"] {
  width: min(220px, 100%);
  accent-color: var(--aqua);
  cursor: pointer;
}

.milestone-settings #timeline-range {
  grid-column: 1 / -1;
}

.unit-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 9px;
  color: var(--muted);
  font-size: clamp(0.54rem, 0.62vw, 0.62rem);
  font-weight: 800;
  line-height: 1;
}

.unit-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.legend-dot {
  width: 0.48rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--legend-color);
  box-shadow: 0 0 0 1px rgba(23, 32, 42, 0.15);
}

.legend-years {
  --legend-color: var(--aqua);
}

.legend-months {
  --legend-color: var(--coral);
}

.legend-weeks {
  --legend-color: var(--gold);
}

.legend-days {
  --legend-color: var(--leaf);
}

.legend-hours {
  --legend-color: var(--sky);
}

.legend-minutes {
  --legend-color: var(--berry);
}

.legend-seconds {
  --legend-color: var(--ink);
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--milestone-count, 8), minmax(142px, 1fr));
  align-items: stretch;
  min-height: clamp(168px, 22vh, 232px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 18px 10px;
  scrollbar-width: thin;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(26, 154, 162, 0.55), rgba(255, 122, 168, 0.52), rgba(255, 224, 113, 0.62));
  box-shadow: 0 0 16px rgba(255, 122, 168, 0.18);
  transform: translateY(-50%);
}

.timeline::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 50%;
  height: 18px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.86) 0 2px, transparent 2.8px) 0 0 / 34px 18px repeat-x;
  transform: translateY(-50%);
  pointer-events: none;
}

.milestone {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  --shape-tilt: 0deg;
  --shape-radius: 18px;
  --shape-path: inset(0 round var(--shape-radius));
  --shape-bg:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 244, 0.91)),
    radial-gradient(circle at 50% 0%, rgba(255, 224, 113, 0.24), transparent 38%);
}

.milestone::before,
.milestone::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  transition: opacity 180ms ease, transform 220ms ease;
}

.milestone::before {
  width: 132px;
  height: 96px;
  background:
    radial-gradient(circle, var(--gold) 0 2px, transparent 2.7px) 4px 8px / 28px 24px,
    radial-gradient(circle, var(--pink) 0 2px, transparent 2.8px) 16px 18px / 34px 28px,
    linear-gradient(35deg, transparent 44%, var(--mint) 45% 55%, transparent 56%) 6px 4px / 36px 28px,
    linear-gradient(-35deg, transparent 44%, var(--lavender) 45% 55%, transparent 56%) 14px 10px / 42px 32px;
}

.milestone::after {
  width: 118px;
  height: 118px;
  background:
    radial-gradient(circle at 50% 0%, var(--gold) 0 3px, transparent 4px),
    radial-gradient(circle at 100% 50%, var(--pink) 0 3px, transparent 4px),
    radial-gradient(circle at 50% 100%, var(--mint) 0 3px, transparent 4px),
    radial-gradient(circle at 0% 50%, var(--sky) 0 3px, transparent 4px),
    conic-gradient(from 0deg, transparent 0 8%, rgba(255, 224, 113, 0.72) 8% 10%, transparent 10% 25%, rgba(255, 122, 168, 0.64) 25% 27%, transparent 27% 48%, rgba(126, 226, 184, 0.64) 48% 50%, transparent 50% 72%, rgba(185, 135, 255, 0.64) 72% 74%, transparent 74%);
  border-radius: 50%;
}

.milestone:hover::before,
.milestone:hover::after,
.milestone:focus-within::before,
.milestone:focus-within::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: sparkle-pop 900ms ease-in-out infinite alternate;
}

.milestone:hover::after,
.milestone:focus-within::after {
  transform: translate(-50%, -50%) scale(1) rotate(18deg);
}

.sparkle-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 32;
  width: 250px;
  height: 190px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.78);
  transition: opacity 160ms ease, transform 220ms ease;
}

.sparkle-burst::before,
.sparkle-burst::after {
  content: "";
  position: absolute;
  inset: 0;
}

.sparkle-burst::before {
  background:
    radial-gradient(circle at 18% 17%, var(--gold) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 18%, var(--pink) 0 4px, transparent 5px),
    radial-gradient(circle at 10% 68%, var(--mint) 0 3px, transparent 4px),
    radial-gradient(circle at 91% 70%, var(--lavender) 0 3px, transparent 4px),
    radial-gradient(circle at 26% 88%, var(--sky) 0 3px, transparent 4px),
    radial-gradient(circle at 73% 88%, var(--coral) 0 3px, transparent 4px);
}

.sparkle-burst::after {
  background:
    linear-gradient(42deg, transparent 43%, var(--gold) 44% 56%, transparent 57%) 12% 28% / 34px 22px no-repeat,
    linear-gradient(-34deg, transparent 43%, var(--pink) 44% 56%, transparent 57%) 84% 30% / 34px 22px no-repeat,
    linear-gradient(26deg, transparent 43%, var(--mint) 44% 56%, transparent 57%) 18% 82% / 32px 20px no-repeat,
    linear-gradient(-28deg, transparent 43%, var(--lavender) 44% 56%, transparent 57%) 82% 80% / 32px 20px no-repeat;
}

.milestone:hover .sparkle-burst,
.milestone:focus-within .sparkle-burst {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: burst-wiggle 950ms ease-in-out infinite alternate;
}

@keyframes burst-wiggle {
  from {
    rotate: -2deg;
  }

  to {
    rotate: 2deg;
  }
}

@keyframes sparkle-pop {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.24) brightness(1.08);
  }
}

.milestone-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: clamp(15px, 1.8vw, 21px);
  aspect-ratio: 1;
  border: 4px solid #fffefd;
  border-radius: 50%;
  background: var(--accent, var(--aqua));
  box-shadow: 0 0 0 1px rgba(23, 32, 42, 0.17), 0 8px 18px rgba(23, 32, 42, 0.16);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.milestone-card {
  position: absolute;
  left: 50%;
  z-index: 1;
  isolation: isolate;
  width: min(148px, calc(100% - 8px));
  min-height: 76px;
  min-width: 0;
  padding: var(--shape-padding, 11px 11px 9px);
  border: 0;
  background: transparent;
  filter: drop-shadow(0 10px 18px rgba(118, 74, 46, 0.1));
  text-align: center;
  transform: translateX(-50%) rotate(var(--shape-tilt));
  transition: width 180ms ease, padding 180ms ease, transform 180ms ease, filter 180ms ease;
}

.milestone-card::before,
.milestone-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.milestone-card::before {
  inset: 0;
  z-index: -1;
  border: 1px solid rgba(23, 32, 42, 0.09);
  border-radius: var(--shape-radius);
  background: var(--shape-bg);
  clip-path: var(--shape-path);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.48);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.milestone-card::after {
  z-index: -1;
}

.milestone-card > * {
  position: relative;
  z-index: 1;
}

.milestone-years {
  --shape-tilt: -1.6deg;
  --shape-padding: 21px 16px 18px;
  --shape-path: polygon(50% 0, 61% 24%, 88% 14%, 82% 40%, 100% 50%, 82% 60%, 88% 86%, 61% 76%, 50% 100%, 39% 76%, 12% 86%, 18% 60%, 0 50%, 18% 40%, 12% 14%, 39% 24%);
  --shape-bg:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.98) 0 44%, transparent 45%),
    linear-gradient(180deg, rgba(255, 246, 190, 0.96), rgba(255, 255, 255, 0.9));
}

.milestone-years .milestone-card {
  min-height: 90px;
}

.milestone-years .milestone-card::before {
  border-color: color-mix(in srgb, var(--accent), white 48%);
}

.milestone-months {
  --shape-tilt: 1deg;
  --shape-padding: 20px 17px 18px;
  --shape-path: polygon(50% 100%, 41% 91%, 14% 66%, 3% 45%, 5% 24%, 20% 7%, 38% 6%, 50% 18%, 62% 6%, 80% 7%, 95% 24%, 97% 45%, 86% 66%, 59% 91%);
  --shape-bg:
    radial-gradient(circle at 32% 23%, rgba(255, 255, 255, 0.96) 0 13%, transparent 14%),
    linear-gradient(180deg, rgba(255, 246, 250, 0.98), rgba(255, 235, 241, 0.94));
}

.milestone-months .milestone-card {
  min-height: 92px;
}

.milestone-months .milestone-card::before {
  border-color: color-mix(in srgb, var(--accent), white 54%);
}

.milestone-weeks {
  --shape-tilt: -1deg;
  --shape-padding: 19px 17px 17px;
  --shape-path: polygon(50% 0, 100% 43%, 55% 100%, 0 43%);
  --shape-bg:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.92) 0 36%, transparent 37%),
    linear-gradient(180deg, rgba(255, 248, 214, 0.98), rgba(255, 255, 255, 0.9));
}

.milestone-weeks .milestone-card {
  min-height: 88px;
}

.milestone-weeks .milestone-card::after {
  left: 50%;
  bottom: -16px;
  width: 1px;
  height: 22px;
  background: linear-gradient(rgba(23, 32, 42, 0.18), transparent);
  transform: translateX(-50%);
}

.milestone-days {
  --shape-radius: 34px 36px 28px 28px;
  --shape-bg:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 255, 244, 0.93)),
    radial-gradient(circle at 50% 0%, rgba(126, 226, 184, 0.2), transparent 40%);
}

.milestone-days .milestone-card {
  min-height: 80px;
  --shape-padding: 14px 11px 9px;
}

.milestone-days .milestone-card::before {
  top: 16px;
  border-color: color-mix(in srgb, var(--accent), white 56%);
  border-radius: 999px 999px 30px 30px;
}

.milestone-days .milestone-card::after {
  left: 19px;
  right: 18px;
  top: 1px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 63%, rgba(255, 255, 255, 0.98) 0 18px, transparent 19px),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.98) 0 24px, transparent 25px),
    radial-gradient(circle at 80% 62%, rgba(255, 255, 255, 0.98) 0 17px, transparent 18px);
  filter: drop-shadow(0 2px 0 color-mix(in srgb, var(--accent), white 68%));
}

.milestone-hours {
  --shape-radius: 24px;
  --shape-tilt: 0.7deg;
  --shape-padding: 12px 13px 10px;
  --shape-path: inset(0 round 24px);
  --shape-bg:
    radial-gradient(circle at 16% 50%, rgba(255, 255, 255, 0.98) 0 8px, transparent 9px),
    radial-gradient(circle at 84% 50%, rgba(255, 255, 255, 0.98) 0 8px, transparent 9px),
    repeating-linear-gradient(115deg, rgba(45, 108, 223, 0.12) 0 9px, transparent 9px 19px),
    linear-gradient(180deg, rgba(244, 249, 255, 0.98), rgba(255, 255, 255, 0.91));
}

.milestone-hours .milestone-card::before {
  border: 2px dashed color-mix(in srgb, var(--accent), white 40%);
}

.milestone-hours .milestone-card::after {
  left: 15px;
  right: 15px;
  bottom: -5px;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), white 62%);
  opacity: 0.72;
}

.milestone-minutes {
  --shape-radius: 50% 50% 45% 45% / 54% 54% 44% 44%;
  --shape-tilt: -0.9deg;
  --shape-padding: 16px 16px 17px;
  --shape-bg:
    radial-gradient(circle at 33% 22%, rgba(255, 255, 255, 0.96) 0 11%, transparent 12%),
    linear-gradient(160deg, rgba(255, 246, 252, 0.98), rgba(255, 255, 255, 0.91));
}

.milestone-minutes .milestone-card {
  min-height: 86px;
}

.milestone-minutes .milestone-card::before {
  border-color: color-mix(in srgb, var(--accent), white 54%);
}

.milestone-minutes .milestone-card::after {
  left: 50%;
  bottom: -8px;
  width: 16px;
  height: 13px;
  background: color-mix(in srgb, var(--accent), white 58%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
}

.milestone-seconds {
  --shape-tilt: 0.9deg;
  --shape-padding: 20px 18px 20px;
  --shape-path: polygon(50% 0, 78% 14%, 92% 42%, 82% 79%, 63% 72%, 50% 100%, 37% 72%, 18% 79%, 8% 42%, 22% 14%);
  --shape-bg:
    radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.9) 0 10%, transparent 11%),
    linear-gradient(180deg, rgba(246, 248, 255, 0.98), rgba(255, 245, 232, 0.91));
}

.milestone-seconds .milestone-card {
  min-height: 94px;
}

.milestone-seconds .milestone-card::before {
  border-color: color-mix(in srgb, var(--accent), white 54%);
}

.milestone-seconds .milestone-card::after {
  left: 50%;
  bottom: -11px;
  width: 28px;
  height: 24px;
  background:
    radial-gradient(circle at 50% 100%, rgba(255, 224, 113, 0.9) 0 36%, transparent 37%),
    linear-gradient(180deg, rgba(232, 93, 79, 0.78), rgba(255, 224, 113, 0));
  clip-path: polygon(50% 100%, 100% 0, 0 0);
  transform: translateX(-50%);
}

.milestone:hover,
.milestone:focus-within {
  z-index: 20;
}

.milestone:hover .milestone-dot,
.milestone:focus-within .milestone-dot {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.92), 0 0 0 8px color-mix(in srgb, var(--accent), transparent 66%), 0 14px 26px rgba(23, 32, 42, 0.18);
  transform: translate(-50%, -50%) scale(1.18);
}

.milestone:hover .milestone-card,
.milestone:focus-within .milestone-card {
  z-index: 30;
  width: min(226px, calc(100% + 92px));
  padding: var(--shape-padding, 10px 12px 11px);
  filter: drop-shadow(0 18px 28px rgba(118, 74, 46, 0.24));
  transform: translateX(-50%) rotate(var(--shape-tilt)) scale(1.03);
}

.milestone:hover .milestone-card::before,
.milestone:focus-within .milestone-card::before {
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 224, 113, 0.46), transparent 24%),
    radial-gradient(circle at 88% 12%, rgba(255, 122, 168, 0.3), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 247, 232, 0.96));
  border-color: color-mix(in srgb, var(--accent), white 42%);
}

.milestone.top:hover .milestone-card,
.milestone.top:focus-within .milestone-card {
  top: 8px;
  bottom: auto;
}

.milestone.bottom:hover .milestone-card,
.milestone.bottom:focus-within .milestone-card {
  top: auto;
  bottom: 8px;
}

.milestone.top .milestone-card {
  bottom: calc(50% + 16px);
}

.milestone.bottom .milestone-card {
  top: calc(50% + 16px);
}

.milestone-card strong,
.milestone-card time,
.milestone-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.milestone-card strong {
  color: var(--ink);
  font-size: clamp(0.66rem, 0.74vw, 0.74rem);
  font-weight: 800;
}

.milestone-card strong .milestone-age {
  display: inline;
  margin-left: 2px;
  overflow: visible;
  color: var(--coral);
  font-size: 0.92em;
  text-overflow: clip;
  white-space: nowrap;
}

.milestone:hover .milestone-card > strong,
.milestone:focus-within .milestone-card > strong {
  font-size: clamp(0.82rem, 0.92vw, 0.96rem);
}

.milestone-card time {
  margin-top: 2px;
  color: var(--muted);
  font-size: clamp(0.56rem, 0.64vw, 0.64rem);
  font-weight: 700;
}

.milestone-card .milestone-source {
  margin-top: 2px;
  color: var(--aqua-dark);
  font-size: clamp(0.54rem, 0.6vw, 0.58rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
}

.milestone-card .milestone-extra {
  margin-top: 3px;
  color: var(--muted);
  font-size: clamp(0.52rem, 0.58vw, 0.56rem);
  font-weight: 700;
  line-height: 1.12;
  white-space: normal;
}

.milestone-popover {
  display: grid;
  gap: 3px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-3px);
  transition: max-height 180ms ease, margin-top 180ms ease, opacity 160ms ease, transform 180ms ease;
}

.milestone:hover .milestone-popover,
.milestone:focus-within .milestone-popover {
  max-height: 150px;
  margin-top: 7px;
  opacity: 1;
  transform: translateY(0);
}

.milestone-popover .party-label,
.milestone-popover .popover-title,
.milestone-popover .popover-detail,
.milestone-popover .popover-related {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.milestone-popover .party-label {
  color: var(--coral);
  font-size: clamp(0.48rem, 0.54vw, 0.54rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.milestone-popover .popover-title {
  color: var(--ink);
  font-size: clamp(0.7rem, 0.82vw, 0.86rem);
  line-height: 1.06;
}

.milestone-popover .popover-detail,
.milestone-popover .popover-related {
  color: var(--muted);
  font-size: clamp(0.54rem, 0.62vw, 0.64rem);
  font-weight: 700;
  line-height: 1.18;
}

.calendar-link {
  display: inline-flex;
  min-width: 0;
  min-height: 0;
  margin-top: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--aqua-dark);
  font-size: clamp(0.5rem, 0.58vw, 0.56rem);
  font-weight: 800;
  line-height: 1.1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.calendar-link:hover {
  background: transparent;
  color: var(--ink);
}

.milestone:hover .milestone-card > .calendar-link,
.milestone:focus-within .milestone-card > .calendar-link {
  justify-self: center;
  min-height: 26px;
  margin-top: 4px;
  padding: 0 10px;
  border: 1px solid rgba(232, 93, 79, 0.18);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 122, 168, 0.18), rgba(255, 224, 113, 0.24));
  color: var(--ink);
  text-decoration: none;
}

.milestone:hover .milestone-card > .calendar-link:hover,
.milestone:focus-within .milestone-card > .calendar-link:hover {
  background: linear-gradient(135deg, rgba(255, 122, 168, 0.28), rgba(255, 224, 113, 0.34));
}

.empty-state {
  align-self: center;
  padding: 18px;
  border: 1px dashed rgba(23, 32, 42, 0.22);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 900px) and (min-height: 650px) {
  body {
    overflow: hidden;
  }
}

@media (max-width: 1040px) {
  .control-bar,
  .event-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .date-form {
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.8fr) minmax(110px, 0.55fr) auto;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .timeline {
    grid-template-columns: repeat(var(--milestone-count, 8), minmax(145px, 1fr));
    min-height: 300px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .timeline::before {
    display: none;
  }

  .milestone {
    min-height: 142px;
  }

  .milestone-card {
    top: auto;
    bottom: auto;
    width: min(140px, calc(100% - 10px));
  }

  .milestone.top .milestone-card,
  .milestone.bottom .milestone-card {
    top: auto;
    bottom: 10px;
  }

  .milestone-dot {
    top: 34px;
  }
}

@media (max-width: 700px) {
  body {
    overflow: auto;
  }

  .garland,
  .cake,
  .balloon-c,
  .party-sprinkle {
    opacity: 0.36;
  }

  .balloon-a,
  .balloon-b {
    top: 5vh;
    width: 42px;
  }

  .app-shell {
    width: min(100% - 18px, 1500px);
    min-height: auto;
  }

  .control-bar {
    padding: 9px;
  }

  h1 {
    font-size: 1.4rem;
  }

  label {
    gap: 3px;
    font-size: 0.64rem;
  }

  input:not([type="checkbox"]):not([type="range"]),
  button {
    min-height: 36px;
  }

  .feedback-fab {
    right: 12px;
    bottom: 12px;
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.78rem;
  }

  .feedback-card {
    max-height: min(92svh, 640px);
    overflow-y: auto;
  }

  .moment-strip,
  .event-panel,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .event-panel-heading {
    align-items: end;
  }

  .event-list {
    grid-auto-columns: minmax(176px, 220px);
  }

  .share-actions {
    grid-template-columns: 1fr;
  }

  .date-form {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .date-form button {
    min-width: 0;
  }

  .section-heading {
    display: grid;
  }

  .milestone-settings {
    justify-items: stretch;
    min-width: 0;
  }

  .milestone-settings,
  .milestone-settings #timeline-range,
  .unit-legend {
    text-align: left;
    justify-content: flex-start;
  }

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 66px;
    padding: 9px;
  }

  .metric-value {
    font-size: clamp(1.08rem, 4.8vw, 1.38rem);
  }

  .metric-note {
    display: none;
  }

  #timeline-range {
    text-align: left;
  }

  .timeline {
    grid-template-columns: repeat(var(--milestone-count, 8), minmax(132px, 1fr));
    min-height: 238px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .milestone {
    min-height: 224px;
  }

  .milestone:hover .milestone-card,
  .milestone:focus-within .milestone-card {
    width: min(192px, calc(100% + 52px));
  }
}

@media (max-width: 360px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .milestone:hover .sparkle-burst,
  .milestone:focus-within .sparkle-burst,
  .milestone:hover::before,
  .milestone:hover::after,
  .milestone:focus-within::before,
  .milestone:focus-within::after {
    animation: none;
  }
}

@media (max-height: 760px) and (min-width: 900px) {
  .app-shell {
    gap: 8px;
  }

  .control-bar,
  .event-panel,
  .moment-strip,
  .timeline-section {
    padding-block: 10px;
  }

  .metric-card {
    min-height: 76px;
    padding-block: 9px;
  }

  .metric-note {
    display: none;
  }

  .timeline {
    min-height: 196px;
  }

  .milestone-card {
    padding-block: 6px;
  }
}
