/* App-faithful phone screens.
 *
 * Each `.app` is the real app's 402 x 874 pt screen (iPhone 16 Pro), laid out in points exactly as
 * the SwiftUI source does it (TrackerView, RootView, LogSleepSheet, the Ask chat view, Theme), then
 * scaled to its phone with one transform. `--w` on `.app-screen` is the on-page screen width in CSS
 * px (unitless), so the screen stays faithful at any size.
 *
 * Colours: every value is a token. Day values come from the site palette (css/site.css :root) and
 * Theme.swift's light tones; Night and Deep-Night use Theme.swift's second and third tones, scoped
 * to the phone component only. Tints are Theme.bubble(): the tint at 14% (day) or 24% (dark).
 */

/* ---------- Scaling ---------- */
.app-screen {
  position: relative;
  width: calc(var(--w, 284) * 1px);
  height: calc(var(--w, 284) * 874 / 402 * 1px);
  overflow: hidden;
  border-radius: calc(var(--w, 284) * 62 / 402 * 1px);
  flex: none;
}
.app-screen > .app {
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(calc(var(--w, 284) / 402));
  transform-origin: 0 0;
}

/* ---------- Theme tokens (Theme.swift) ---------- */
.app {
  /* Day: Theme.swift's first tone. */
  --a-bg: var(--page);
  --a-surface: var(--card);
  --a-blush: var(--blush);
  --a-petal: var(--petal);
  --a-sleep-panel: var(--sleep-panel);
  --a-dock: #FFF8FA;           /* Theme.dockSurface (day) */
  --a-ink: var(--ink);
  --a-ink-2: var(--ink-2);
  --a-ink-3: var(--ink-3);
  --a-hair: var(--hairline);
  --a-feed: var(--feed);
  --a-sleep: var(--sleep);
  --a-diaper: var(--diaper);
  --a-health: var(--health);
  --a-pump: var(--pump);
  --a-bottle: var(--bottle);
  --a-growth: var(--growth);
  --a-memories: var(--memories);
  --a-solids: var(--solids);
  --a-feed-glyph: var(--feed-glyph);
  --a-sleep-glyph: var(--sleep-glyph);
  --a-ai: var(--ai);
  --a-ask-fill: var(--ai-fill);
  --a-success: var(--success);
  --a-warning: var(--warning);
  --a-white: var(--on-accent);
  --a-zzz: #6D5A78;            /* SleepingBabyArt "z z Z" (day) */
  --a-avatar-e: #8C4E63;       /* FamilyHeaderBadge ink, parent A (day) */
  --a-avatar-j: #5B4B94;       /* FamilyHeaderBadge ink, parent B (day) */
  /* Theme.bubble: 14% by day, 24% in the dark postures. */
  --a-tint: 14%;
  /* TrackerView.homeStopColor / homeSleepGlyph: feed + blue moon by day, sleep teal at night. */
  --a-stop: var(--a-feed);
  --a-home-moon: var(--a-sleep-glyph);
  /* Faint warm shadow by day (imaniCard); none in the dark postures. */
  --a-card-shadow: 0 4px 20px color-mix(in srgb, var(--a-feed) 6%, var(--clear));
  --a-dock-shadow: 0 -2px 20px color-mix(in srgb, var(--a-feed) 8%, var(--clear));
  --a-panel-shadow: 0 7px 28px color-mix(in srgb, var(--a-feed) 10%, var(--clear));
  --a-ask-shadow: 0 3px 16px color-mix(in srgb, var(--a-ai) 18%, var(--clear));
  --a-dock-stroke: 0.75px;
  --a-divider-opacity: 0;
}
.app[data-theme="night"] {
  --a-bg: #120C15;
  --a-surface: #211824;
  --a-blush: #251B2A;
  --a-petal: #231A27;
  --a-sleep-panel: #1C141D;
  --a-dock: #1D151F;
  --a-ink: #F4EEF4;
  --a-ink-2: #B8A9BC;
  --a-ink-3: #85768A;
  --a-hair: #33283A;
  --a-feed: #D9577B;
  --a-sleep: #43A4B2;
  --a-diaper: #D2AC41;
  --a-health: #C96275;
  --a-pump: #9A7BF7;
  --a-bottle: #F08A3C;
  --a-growth: #7FA0F0;
  --a-memories: #F0719F;
  --a-solids: #62B964;
  --a-feed-glyph: #F078A8;
  --a-sleep-glyph: #80A8F8;
  --a-ai: #3AA68C;
  --a-ask-fill: #2A9E8C;
  --a-success: #5BA376;
  --a-warning: #C98835;
  --a-zzz: #B9A7E3;
  --a-avatar-e: #F0B8CB;
  --a-avatar-j: #CDBDF5;
  --a-tint: 24%;
  --a-stop: var(--a-sleep);
  --a-home-moon: var(--a-sleep);
  --a-card-shadow: none;
  --a-dock-shadow: none;
  --a-panel-shadow: none;
  --a-ask-shadow: 0 3px 16px color-mix(in srgb, var(--a-ai) 18%, var(--clear));
  --a-dock-stroke: 1px;
  --a-divider-opacity: 1;
}
/* Deep-Night: every accent collapses to one dim red; neutrals go near-black and amber. */
.app[data-theme="deep"] {
  --a-bg: #090605;
  --a-surface: #150B08;
  --a-blush: #150B08;
  --a-petal: #150B08;
  --a-sleep-panel: #0D0706;
  --a-dock: #110907;
  --a-ink: #E0A07A;
  --a-ink-2: #B96E4A;
  --a-ink-3: #754226;
  --a-hair: #2E170F;
  --a-deep: #B5503A;
  --a-feed: var(--a-deep);
  --a-sleep: var(--a-deep);
  --a-diaper: var(--a-deep);
  --a-health: var(--a-deep);
  --a-pump: var(--a-deep);
  --a-bottle: var(--a-deep);
  --a-growth: var(--a-deep);
  --a-memories: var(--a-deep);
  --a-solids: var(--a-deep);
  --a-feed-glyph: var(--a-deep);
  --a-sleep-glyph: var(--a-deep);
  --a-ai: var(--a-deep);
  --a-ask-fill: #5A2A1C;
  --a-success: var(--a-deep);
  --a-warning: var(--a-deep);
  --a-zzz: #B96E4A;
  --a-avatar-e: #E0A07A;
  --a-avatar-j: #E0A07A;
  --a-tint: 24%;
  --a-stop: var(--a-sleep);
  --a-home-moon: var(--a-sleep);
  --a-card-shadow: none;
  --a-dock-shadow: none;
  --a-panel-shadow: none;
  --a-ask-shadow: 0 3px 16px color-mix(in srgb, var(--a-ai) 18%, var(--clear));
  --a-dock-stroke: 1px;
  --a-divider-opacity: 1;
}

/* Tint helpers: `--t` is the activity colour of a disc, chip or tile. */
.t-feed { --t: var(--a-feed); }
.t-feed-glyph { --t: var(--a-feed-glyph); }
.t-sleep { --t: var(--a-sleep); }
.t-moon { --t: var(--a-home-moon); }
.t-diaper { --t: var(--a-diaper); }
.t-health { --t: var(--a-health); }
.t-pump { --t: var(--a-pump); }
.t-bottle { --t: var(--a-bottle); }
.t-growth { --t: var(--a-growth); }
.t-memories { --t: var(--a-memories); }
.t-solids { --t: var(--a-solids); }
.t-ai { --t: var(--a-ai); }

/* ---------- The screen ---------- */
.app {
  --serif: ui-serif, "New York", "NN Serif", Georgia, serif;
  --serif-num: ui-serif, "New York", "NN Serif Num", Georgia, serif;
  --serif-clock: ui-serif, "New York", "NN Serif Clock", Georgia, serif;
  --sans: system-ui, -apple-system, "Instrument Sans", sans-serif;
  position: relative;
  width: 402px;
  height: 874px;
  overflow: hidden;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: var(--sans);
  /* Theme.sans pins SF Pro to its Display optical size at every point size. */
  font-variation-settings: "opsz" 28;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.178;   /* SF Pro: ascender + descender */
  letter-spacing: 0;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  user-select: none;
  -webkit-user-select: none;
}
.app * { box-sizing: border-box; }
.app p { margin: 0; }
.app img { display: block; max-width: none; }
.app .serif { font-family: var(--serif); font-variation-settings: normal; line-height: 1.15; }   /* New York on iOS: ~0.99 + 0.16 */
:where(.app) button {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: var(--clear);
}
/* Focus stays a clear 3 page-pixels whatever the phone's scale. */
.app button:focus-visible {
  outline: calc(3px * 402 / var(--w, 402)) solid var(--teal-deep);
  outline-offset: calc(2px * 402 / var(--w, 402));
}

/* SF Symbol stand-ins: a 24-unit em box, sized by font-size like the symbol's point size. */
.g {
  display: block;
  width: 1em;
  height: 1em;
  flex: none;
  overflow: visible;
  fill: currentColor;
}

/* Card treatment (Theme.imaniCard): surface, 14pt corners, hairline drawn over the content. */
.app .card {
  position: relative;
  background: var(--a-surface);
  border-radius: 14px;
  box-shadow: var(--a-card-shadow);
}
.app .card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--a-hair);
  border-radius: inherit;
  pointer-events: none;
}

/* IconBubble: glyph centred in its pastel disc. */
.bubble {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--t) var(--a-tint), var(--clear));
  color: var(--t);
}
.bubble.solid { background: var(--t); color: var(--a-white); }

/* ---------- Status bar ---------- */
.sb {
  position: absolute;
  inset: 0 0 auto 0;
  height: 54px;
  color: var(--a-ink);
  pointer-events: none;
}
.sb-time {
  position: absolute;
  left: 29px;
  top: 21px;
  width: 91px;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}
.sb-island {
  position: absolute;
  left: 138px;
  top: 14px;
  width: 126px;
  height: 37px;
  border-radius: 19px;
  background: var(--device);
}
.sb-icons { position: absolute; left: 288px; top: 26px; display: flex; align-items: flex-end; gap: 8px; }
.sb-signal { width: 19px; height: 12px; }
.sb-wifi { width: 17px; height: 12.5px; }
.sb-battery { width: 28px; height: 13px; margin-left: -1px; }
.sb svg { fill: currentColor; }
.bat-shell { color: var(--a-ink); opacity: 0.4; }
.bat-fill { color: var(--a-success); }
.c-feed-glyph { color: var(--a-feed-glyph); }
/* Asset-catalogue dark appearance: the smiling baby has its own art for dark backgrounds. */
.app[data-theme="day"] .art-dark, .app:not([data-theme="day"]) .art-light { display: none; }

/* ---------- Home ---------- */
.home {
  position: absolute;
  top: 62px;
  left: 14px;
  right: 14px;
  height: 708px;           /* measured: the dashboard ends 22pt above the dock, as in the reference */
  display: flex;
  flex-direction: column;
}
.gap { flex: 1 1 0; min-height: 8px; }

.hd { display: flex; align-items: flex-start; gap: 8px; flex: none; }
.hd-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hd-name { display: flex; align-items: center; gap: 9px; }
.hd-name .serif { font-size: 25px; font-weight: 600; }
.hd-name .g { font-size: 13.4px; color: var(--a-memories); margin-top: -3px; }
.hd-age { font-size: 12.5px; color: var(--a-ink-2); white-space: pre; }
.hd-badge { display: flex; align-items: center; gap: 16px; padding-top: 2px; }
.avatars { display: flex; gap: 3px; }
.avatar {
  width: 28px;
  height: 28px;
  font-size: 14px;
  line-height: 1;
  padding-top: 1px;
}
.avatar.e { color: var(--a-avatar-e); }
.avatar.j { color: var(--a-avatar-j); }
.sync { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--a-success); transition: background-color 0.3s; }
.sync .g { font-size: 10.5px; color: var(--a-ink-2); margin-left: -1px; }
.sync.is-syncing .sync-dot { background: var(--a-warning); }

/* Sleep hero */
.hero {
  flex: none;
  display: flex;
  align-items: center;
  padding: 12px 9px 12px 12px;
}
.app .card.hero { background: var(--a-blush); }
.hero-timer { flex: none; display: flex; flex-direction: column; text-align: left; }
.hero-label { font-size: 15px; font-weight: 500; color: var(--a-ink-2); white-space: nowrap; }
.hero-metric {
  font-family: var(--serif-num);
  font-size: 37px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.hero-since { font-size: 13.5px; color: var(--a-ink-2); white-space: nowrap; }
.hero-since b { font-weight: 500; color: var(--a-ink); }
.hero-art {
  flex: 0 1 133px;
  min-width: 70px;
  aspect-ratio: 960 / 618;
  position: relative;
  container-type: inline-size;
}
.hero-art img, .timer-art img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
/* "z z Z" / sparkles: centres as fractions of the art width from the image's top-left corner. */
.zz { position: absolute; display: grid; place-items: center; line-height: 1; font-weight: 500; color: var(--a-zzz); }
.hero-art .zz, .timer-art .zz { --top: 10cqw; }
.zz-1 { font-size: 9.5cqw; width: 9.5cqw; height: 9.5cqw; left: calc(35cqw - 4.75cqw); top: calc(var(--top) + 3.5cqw - 4.75cqw); }
.zz-2 { font-size: 11.5cqw; width: 11.5cqw; height: 11.5cqw; left: calc(44cqw - 5.75cqw); top: calc(var(--top) - 2cqw - 5.75cqw); }
.zz-3 { font-size: 10cqw; width: 10cqw; height: 10cqw; left: calc(54cqw - 5cqw); top: calc(var(--top) - 6.5cqw - 5cqw); }
.spk { position: absolute; }
.spk .g { width: 100%; height: 100%; }
.spk-1 { width: 7.5cqw; height: 7.5cqw; left: calc(34cqw - 3.75cqw); top: calc(var(--top) + 3cqw - 3.75cqw); color: var(--a-memories); }
.spk-2 { width: 5cqw; height: 5cqw; left: calc(8cqw - 2.5cqw); top: calc(var(--top) + 12cqw - 2.5cqw); color: var(--a-diaper); }
.spk-3 { width: 4.5cqw; height: 4.5cqw; left: calc(40cqw - 2.25cqw); top: calc(var(--top) + 16cqw - 2.25cqw); color: var(--a-pump); }
.hero-art .spk { --top: 10cqw; }
.hero-actions { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.pill {
  min-width: 97px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--a-stop);
  color: var(--a-white);
  font-size: 13px;
  font-weight: 500;
  line-height: 32px;
  white-space: nowrap;
  text-align: center;
}
.hero-link {
  min-height: 28px;
  padding-right: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--a-ink-2);
  white-space: nowrap;
}
.hero-link .g { font-size: 12px; }
.is-awake .pill { background: var(--a-sleep); }
.app:not(.is-awake) .when-awake, .app.is-awake .when-asleep { display: none; }

/* Last feed / last diaper */
.events { flex: none; display: flex; gap: 8px; }
.event {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 18px 10px;
}
.event > .bubble { width: 52px; height: 52px; margin-right: 10px; font-size: 22.9px; }
.event-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event-label, .event-detail { font-size: 12px; color: var(--a-ink-2); }
.app .event-value { font-family: var(--serif-num); font-size: 21px; font-weight: 600; white-space: nowrap; }
.event > .g, .guide > .g, .vaccine > .g { font-size: 13px; color: var(--a-ink-2); margin-left: 4px; }

/* Quick actions */
.actions {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 6px;
  row-gap: 14px;
  padding: 14px 8px;
}
.action { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; line-height: 13px; color: var(--a-ink); }
.action > .bubble { width: 50px; height: 50px; font-size: 22px; }

/* Ask banner */
.ask-banner {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 10px;
  border-radius: 18px;
  background: var(--a-ask-fill);
  color: var(--a-white);
  box-shadow: var(--a-ask-shadow);
}
.ask-banner-disc {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: color-mix(in srgb, var(--a-white) 16%, var(--clear));
}
.ask-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ask-banner-title { font-size: 12.5px; font-weight: 500; }
.ask-banner-sub { font-size: 11.5px; color: color-mix(in srgb, var(--a-white) 94%, var(--clear)); white-space: nowrap; }
.ask-banner > .g { font-size: 15px; margin-left: 4px; }

/* Today at a glance */
.glance { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 9px; }
.glance-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.glance-title { font-size: 11px; font-weight: 500; }
.glance-note { font-size: 9px; color: var(--a-ink-2); white-space: nowrap; }
.glance-row { display: flex; align-items: center; }
.stat { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 7px; }
.stat > .bubble { width: 32px; height: 32px; font-size: 14.4px; }
.stat-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-value { font-size: 13px; font-weight: 500; white-space: nowrap; }
.stat-label { font-size: 10.5px; color: var(--a-ink-2); white-space: nowrap; }
.glance-div { flex: none; width: 1px; height: 26px; margin: 0 3px; background: var(--a-hair); opacity: var(--a-divider-opacity); }

/* Today's guide + next vaccine */
.cards2 { flex: none; display: flex; align-items: stretch; gap: 8px; }
.guide { flex: 1 1 0; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.guide-art { flex: none; align-self: stretch; width: 56px; position: relative; }
.guide-art .bubble { width: 29px; height: 29px; font-size: 15px; margin: 8px 0 0 9px; }
.guide-art img { position: absolute; left: 0; bottom: 0; width: 54px; height: auto; }
.guide-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 10px 0; }
.small-label { font-size: 10.5px; color: var(--a-ink-2); white-space: nowrap; }
.card-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.card-copy { font-size: 11.5px; color: var(--a-ink-2); }
.guide > .g { margin: 0 11px 0 6px; }
.vaccine { flex: none; width: 146px; display: flex; align-items: center; gap: 4px; padding: 9px 10px 9px 9px; }
.vaccine-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vaccine-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.vaccine-head .bubble { width: 32px; height: 32px; font-size: 15px; }
.vaccine > .g { margin: 30px 0 0; }

/* Sync-demo highlight: a gentle tinted wash that fades back to the card. */
@keyframes app-flash {
  0% { background-color: color-mix(in srgb, var(--t) var(--a-tint), var(--a-surface)); }
  100% { background-color: var(--a-surface); }
}
.app .flash { animation: app-flash 1.8s ease-out both; }
.app .hero.flash { animation-name: app-flash-hero; }
@keyframes app-flash-hero {
  0% { background-color: color-mix(in srgb, var(--a-sleep) 22%, var(--a-blush)); }
  100% { background-color: var(--a-blush); }
}
@media (prefers-reduced-motion: reduce) {
  .app .flash, .app .hero.flash { animation: none; background-color: color-mix(in srgb, var(--t, var(--a-sleep)) var(--a-tint), var(--a-surface)); }
  .app .hero.flash { background-color: var(--a-blush); }
  .sync-dot { transition: none; }
}

/* ---------- Dock (RootView.tabBar) ---------- */
.dock { position: absolute; left: 0; right: 0; top: 778px; height: 96px; }
.dock-bg { position: absolute; inset: 0; width: 402px; height: 96px; filter: drop-shadow(var(--a-dock-shadow)); }
.dock-bg path { fill: var(--a-dock); stroke: var(--a-hair); stroke-width: var(--a-dock-stroke); }
.dock-bar { position: absolute; left: 6px; right: 6px; top: 14px; height: 48px; display: flex; align-items: flex-start; }
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-top: 5px;
  font-size: 11px;
  color: var(--a-ink-2);
}
.tab .g-wrap { height: 26px; display: grid; place-items: center; font-size: 18px; }
.tab.on { color: var(--a-feed); }
.tab-log { gap: 4px; padding-top: 0; }
.fab {
  width: 42px;
  height: 42px;
  margin-top: -9px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--a-feed);
  color: var(--a-white);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--a-feed) 30%, var(--clear));
}

/* ---------- Live sleep page (LogSleepSheet, embedded) ---------- */
.timer-page {
  position: absolute;
  top: 62px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.panel {
  position: relative;
  background: var(--a-bg);
  border-radius: 18px;
  box-shadow: var(--a-panel-shadow);
  padding: 16px 16px 30px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.panel::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--a-hair); border-radius: inherit; pointer-events: none; }
.timer-art {
  width: 155px;
  height: 84.3px;
  margin: 15.5px auto 22px;
  position: relative;
  container-type: inline-size;
}
.timer-art .zz { --top: 0cqw; }
.timer-title { text-align: center; font-size: 26px; font-weight: 600; }
.app .timer-clock {
  text-align: center;
  font-family: var(--serif-clock);
  font-variation-settings: normal;
  font-size: 104px;
  font-weight: 600;
  line-height: 1.15;
  margin: -9px 0;          /* LogSleepSheet.timerClockTrim: 17 - size * 0.25 */
  font-variant-numeric: tabular-nums;
  color: var(--a-sleep);
  letter-spacing: -1px;
}
.timer-start { min-height: 40px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.timer-start b { font-size: 17.5px; font-weight: 500; }
.timer-start span { font-size: 14px; color: var(--a-ink-2); }
.timer-rule { height: 1px; background: var(--a-hair); margin: 13px 0; }
.chips { display: flex; gap: 9px; margin-bottom: 16px; }
.chip {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0;
  border-radius: 13px;
  background: var(--a-petal);
}
.chip::after, .note::after, .save-done::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--a-hair); border-radius: inherit; pointer-events: none; }
.chip .bubble { width: 32px; height: 32px; font-size: 18px; margin-bottom: 7px; }
.chip b { font-size: 15px; font-weight: 600; }
.chip .earlier { font-size: 13px; color: var(--a-ink-2); }
.note {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 13px;
  background: var(--a-petal);
  margin-bottom: 13px;
}
.note .bubble { width: 35px; height: 35px; font-size: 16px; }
.note p { max-width: 185px; font-size: 13.5px; color: var(--a-ink-2); }
.timer-buttons { display: flex; flex-direction: column; gap: 8px; margin: 0 -7px; }
.stop {
  min-height: 49px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--a-sleep);
  color: var(--a-white);
  font-size: 18px;
  font-weight: 500;
}
.save-done {
  position: relative;
  min-height: 47px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--a-petal);
  color: var(--a-sleep);
}
.save-done .g { font-size: 20px; }
.save-done span { font-size: 12.5px; font-weight: 600; }

/* ---------- Ask (the Ask chat screen) ---------- */
.ask-head { position: absolute; top: 62px; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 11px; }
.ask-back { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.ask-back span {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--a-surface);
  font-size: 16px;
}
.ask-back span::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--a-hair); border-radius: 50%; }
.ask-title { display: flex; flex-direction: column; gap: 2px; }
.ask-title b { font-size: 27px; font-weight: 600; white-space: nowrap; }
.ask-title span { font-size: 12.5px; color: var(--a-ink-2); }
.ask-scroll { position: absolute; top: 123px; left: 0; right: 0; bottom: 124px; overflow: hidden; padding: 8px 14px 20px; }
.ask-empty, .ask-convo { display: flex; flex-direction: column; gap: 12px; }
.ask-greet { display: flex; align-items: center; gap: 14px; padding: 16px 16px 14px; border-radius: 22px; background: var(--a-blush); }
.ask-greet-av { width: 86px; height: 86px; border-radius: 50%; background: var(--a-surface); overflow: hidden; position: relative; flex: none; }
.ask-greet-av img { position: absolute; left: 4px; bottom: 0; width: 78px; height: auto; }
.ask-greet-text { display: flex; flex-direction: column; gap: 9px; min-width: 0; }   /* 6pt + New York's trailing leading (measured) */
.app .ask-greet-text b { font-size: 21px; font-weight: 600; line-height: 1.19; --nn-track: 0.6px; }
.ask-greet-text span { font-size: 12.5px; color: var(--a-ink-2); }
.ask-sec { display: flex; flex-direction: column; gap: 7px; padding-top: 2px; }
.ask-sec.try { gap: 8px; }
.ask-label { padding: 0 2px; font-size: 11px; font-weight: 500; letter-spacing: 0.6px; text-transform: uppercase; color: var(--a-ink-2); }
.flow { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--t) var(--a-tint), var(--clear));
  font-size: 12.5px;
  white-space: nowrap;
}
.tchip .g { font-size: 13.5px; color: var(--t); }
.tchip .g.tall { height: 1.26em; }   /* waterbottle.fill is taller than its point size, so its chip is too */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tile {
  min-height: 138px;        /* measured: the Grid rows stretch the 118pt minimum */
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--t) var(--a-tint), var(--clear));
}
.tile .bubble { width: 34px; height: 34px; font-size: 17px; }
.app .tile b { flex: 1; font-size: 15px; font-weight: 600; line-height: calc(1.19em + 1px); --nn-track: 0.15px; }
.tile-tag { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--a-ink-2); }
.tile-tag .g { font-size: 11px; }

/* Conversation */
.ask-q {
  align-self: flex-end;
  max-width: calc(100% - 60px);
  padding: 11px 15px;
  border-radius: 20px 20px 6px 20px;
  background: var(--a-memories);
  color: var(--a-white);
  font-size: 15px;
}
.ask-a { display: flex; align-items: flex-start; gap: 9px; }
.ask-av { width: 34px; height: 34px; border-radius: 50%; background: var(--a-blush); overflow: hidden; position: relative; flex: none; }
.ask-av img { position: absolute; left: 1px; bottom: 0; width: 32px; height: auto; }
.ask-card {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border-radius: 6px 20px 20px 20px;
  background: var(--a-surface);
  box-shadow: var(--a-card-shadow);
}
.ask-card::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--a-hair); border-radius: inherit; pointer-events: none; }
.app .ask-lead { font-size: 18px; font-weight: 600; line-height: calc(1.19em + 2px); --nn-track: 0.4px; }
.ask-body { font-size: 14.5px; line-height: calc(1.178em + 3px); }
.ask-stats { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ask-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--t) var(--a-tint), var(--clear));
}
.ask-stat span { font-size: 11px; color: var(--a-ink-2); }
.ask-stat b { font-size: 15px; font-weight: 600; }
.ask-source {
  align-self: stretch;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--a-petal);
}
.ask-source .g { font-size: 15px; color: var(--a-pump); }
.ask-source b { flex: 1; min-width: 0; font-size: 13px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-source span { font-size: 11px; color: var(--a-ink-2); }
.ask-basis { display: flex; align-items: baseline; gap: 6px; font-size: 11.5px; color: var(--a-ink-2); }
.ask-basis .g { font-size: 12.5px; position: relative; top: 2px; }
.ask-safety { font-size: 12.5px; color: var(--a-ink-2); }
.ask-nma { align-self: stretch; padding-top: 8px; border-top: 1px solid var(--a-hair); font-size: 11px; color: var(--a-ink-3); }
.ask-follow { display: flex; flex-wrap: wrap; gap: 7px; padding-left: 43px; }
.ask-follow .tchip { min-height: 29px; }
.ask-loading { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--a-ink-2); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--a-ai); animation: app-dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes app-dot { 0%, 60%, 100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.fade-in { animation: app-fade 0.4s ease-out both; }
@keyframes app-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .dots i, .fade-in { animation: none; }
}

/* Input bar */
.ask-input {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--a-bg);
  border-top: 1px solid var(--a-hair);
}
.ask-input::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 34px; background: var(--a-bg); }
.ask-note { text-align: center; font-size: 11px; color: var(--a-ink-3); }
.ask-row { display: flex; align-items: center; gap: 9px; }
.ask-field {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 0 16px;
  border-radius: 24px;
  background: var(--a-surface);
}
.ask-field::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--a-hair); border-radius: inherit; pointer-events: none; }
.ask-text { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; }
.ask-ph { color: var(--a-ink-3); opacity: 0.75; }
.ask-typed:not(:empty) + .ask-ph { display: none; }
.ask-typed:not(:empty)::after { content: ""; display: inline-block; width: 1.5px; height: 18px; margin-left: 1px; vertical-align: -3px; background: var(--a-pump); }
.ask-mic { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.ask-mic .bubble { width: 36px; height: 36px; font-size: 16px; }
.ask-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 18px;
  background: var(--a-ask-fill);
  color: var(--a-white);
  opacity: 0.27;            /* 0.55, then SwiftUI's disabled dimming (measured) */
  transition: opacity 0.2s;
}
.ask-send.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ask-send { transition: none; } }

/* ---------- The sleep Live Activity (BabeLiveActivity.swift) ----------
 * The lock-screen banner inside a locked phone (whose island is just the camera cut-out, as iOS
 * shows no Dynamic Island content while locked), and the Dynamic Island on its own, in its compact
 * and expanded presentations. All in the widget's own point sizes. Sleep aqua is Theme.sleep;
 * "secondary" is iOS's secondary label on black. night-demo.js ticks the timers and toggles
 * .is-expanded on the island.
 */
.app.lock, .di-stage {
  --la-font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Instrument Sans", sans-serif;
  --la-secondary: color-mix(in srgb, var(--on-accent) 60%, var(--clear));
  color: var(--on-accent);
}
.app.lock { background: var(--night-surface); }
.lock .sb { color: var(--on-accent); }

/* The island on its own, on a flat screen-coloured card so the black pill reads on the dark page:
 * 371pt expanded, scaled to fill the card, which is as wide as the lock phone below it. */
.di-stage {
  --s: calc((var(--w, 240) + 18 - 32) / 371);
  position: relative;
  box-sizing: content-box;
  width: calc(371px * var(--s));
  height: calc(84px * var(--s));
  padding: 22px 16px;
  border-radius: 28px;
  background: var(--night-surface);
  font-family: system-ui, -apple-system, "Instrument Sans", sans-serif;
  font-variation-settings: "opsz" 28;
  font-size: 13px;
  line-height: 1.178;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.di-scale { position: absolute; left: 16px; top: 22px; width: 371px; height: 84px; transform: scale(var(--s)); transform-origin: 0 0; }
.di-stage p { margin: 0; }
.la-moon { color: var(--sleep); }
.la-clock { font-family: var(--la-font); font-variation-settings: normal; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; color: var(--sleep); }

.di {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 232px;
  height: 37px;
  border-radius: 19px;
  background: var(--device);
  overflow: hidden;
  z-index: 2;
  transition: width 0.55s cubic-bezier(0.32, 1.2, 0.5, 1), height 0.55s cubic-bezier(0.32, 1.2, 0.5, 1), border-radius 0.55s ease;
}
.di.is-expanded { width: 371px; height: 84px; border-radius: 42px; }
.di-compact, .di-expanded { position: absolute; left: 50%; top: 0; translate: -50% 0; }
/* compactLeading: the moon; compactTrailing: a 46pt timer. The camera sits between them. */
.di-compact {
  width: 232px;
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 17px;
  transition: opacity 0.2s ease 0.3s;
}
.di-compact .la-moon { font-size: 15px; }
.di-compact .la-clock { width: 46px; font-size: 13px; font-weight: 600; }
/* Expanded: leading "Sleeping", trailing an 84pt timer, bottom the baby's name. */
.di-expanded {
  width: 371px;
  height: 84px;
  padding: 12px 20px 0 22px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.di.is-expanded .di-compact { opacity: 0; transition: opacity 0.12s ease; }
.di.is-expanded .di-expanded { opacity: 1; transition: opacity 0.25s ease 0.2s; }
.di-row { display: flex; align-items: center; justify-content: space-between; height: 36px; }
.di-lead { display: flex; align-items: center; gap: 8px; padding-left: 4px; }
.di-lead .la-moon { font-size: 16px; }
.di-lead b { font-size: 14px; font-weight: 600; }
.di-row .la-clock { width: 84px; margin-right: 4px; font-size: 26px; font-weight: 700; line-height: 1; }
.di-name { text-align: center; font-size: 13px; color: var(--la-secondary); margin-top: 6px; }

.lock-date { position: absolute; left: 0; right: 0; top: 78px; text-align: center; font-size: 20px; font-weight: 600; opacity: 0.9; }
.lock-time {
  position: absolute;
  left: 0;
  right: 0;
  top: 106px;
  text-align: center;
  font-size: 100px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}
/* The lock-screen presentation: .activityBackgroundTint(black at 55%), 16pt padding. */
.la-banner {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 548px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--device) 55%, var(--clear));
}
.la-disc { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 17px; background: color-mix(in srgb, var(--sleep) 25%, var(--clear)); }
.la-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.la-text b { font-family: var(--la-font); font-variation-settings: normal; font-size: 15px; font-weight: 600; }
.la-text span { font-size: 12px; color: var(--la-secondary); }
.la-banner .la-clock { width: 92px; flex: none; font-size: 28px; font-weight: 700; line-height: 1; }
.lock-bar { position: absolute; left: 50%; bottom: 8px; width: 134px; height: 5px; margin-left: -67px; border-radius: 3px; background: var(--on-accent); }

/* ---------- Where New York is not available ----------
 * Non-WebKit browsers get Newsreader for the app's serif (see the NN Serif faces in site.css).
 * Its set width grows more slowly with size than New York's, so text sizes get a little tracking,
 * and the 104pt clock is re-proportioned. WebKit (Safari, and every iOS browser) has New York
 * through ui-serif and keeps the source values. */
@supports not (font: -apple-system-body) {
  .app .serif { letter-spacing: var(--nn-track, 0px); }
  .app .timer-clock { letter-spacing: -6px; margin: -5px 0 -2.7px; text-indent: -6px; }
}
