/* Avril: a cloth-bound diary made for one little girl.
   Ivory paper, plum ink, a lavender ribbon that marks the page. */

@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f7f1e8; --ivory: #fffbf4; --ivory-2: #fbf5ec;
  --ink: #2e2433; --ink-2: #6f6170; --ink-3: #9d909b; --rule: rgba(46, 36, 51, 0.09); --rule-2: rgba(46, 36, 51, 0.16);
  --lav: #8c74c9; --lav-ink: #5d4899; --lav-soft: #ece4f6; --lav-wash: #f3eef9;
  --rose: #e2b9bb; --rose-ink: #8a4a52; --rose-soft: #f6e5e2;
  --sage: #9fbca6; --sage-ink: #3f6a4f; --sage-soft: #e4eee5;
  --honey: #e0b36b; --honey-ink: #80571a; --honey-soft: #f7ead2;
  --sky: #a9c3e0; --sky-ink: #345a85; --sky-soft: #e3ecf6;
  --warn: #a8432c; --warn-soft: #f8e2da;
  --shadow-1: 0 1px 2px rgba(60, 40, 70, 0.05), 0 8px 24px -16px rgba(60, 40, 70, 0.25);
  --shadow-2: 0 2px 6px rgba(60, 40, 70, 0.06), 0 24px 48px -24px rgba(60, 40, 70, 0.35);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: "Figtree", -apple-system, "SF Pro Text", system-ui, "Segoe UI", sans-serif;
  --r-lg: 28px; --r-md: 20px; --r-sm: 14px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --tab-h: 64px; --kb: 0px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #17111c; --ivory: #221a28; --ivory-2: #1d1622;
  --ink: #f3eaf1; --ink-2: #b8a9b8; --ink-3: #847585; --rule: rgba(243, 234, 241, 0.08); --rule-2: rgba(243, 234, 241, 0.16);
  --lav: #b9a3ee; --lav-ink: #cbbaf6; --lav-soft: #2f2440; --lav-wash: #261d31;
  --rose: #a86e78; --rose-ink: #f0c3c8; --rose-soft: #3a2530;
  --sage: #6f9a7d; --sage-ink: #bfdcc7; --sage-soft: #1f3128;
  --honey: #c99a52; --honey-ink: #f2d39c; --honey-soft: #3a2c18;
  --sky: #6d8fb5; --sky-ink: #c3d7ef; --sky-soft: #1f2b3b;
  --warn: #f09a80; --warn-soft: #3c2219;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.7);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 48px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; overflow: hidden; overscroll-behavior: none;
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-optical-sizing: auto;
}
/* Paper grain, kept to a whisper. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .3 0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.18; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--lav); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ icons */
.ico { width: 22px; height: 22px; display: inline-flex; flex: none; }
.ico svg { width: 100%; height: 100%; }
.ico.sm { width: 18px; height: 18px; } .ico.lg { width: 28px; height: 28px; } .ico.xl { width: 40px; height: 40px; }

/* ------------------------------------------------------------ type */
.display { font: 400 44px/1 var(--serif); letter-spacing: -0.01em; margin: 0; }
.title { font: 400 34px/1.05 var(--serif); letter-spacing: -0.005em; margin: 0; text-wrap: balance; }
.h2 { font: 400 25px/1.15 var(--serif); margin: 0; text-wrap: balance; }
.h3 { font: 650 15px/1.3 var(--sans); margin: 0; letter-spacing: 0.005em; }
.eyebrow { font: 650 11.5px/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.small { font-size: 13.5px; line-height: 1.45; }
.it { font-style: italic; font-family: var(--serif); }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ app frame */
#app { position: fixed; inset: 0; z-index: 1; }
.tabs-host, .stack-host { position: absolute; inset: 0; }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(var(--sat) + 14px) calc(var(--sar) + 20px) calc(var(--sab) + var(--tab-h) + 32px) calc(var(--sal) + 20px);
  background: transparent;
}
.screen.detail { background: var(--paper); padding-bottom: calc(var(--sab) + 40px); z-index: 5; box-shadow: -12px 0 40px -20px rgba(0,0,0,.25); }
.inner { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.screen-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 18px; }
.screen-head .title { flex: 1; min-width: 0; }
.nav-bar {
  position: sticky; top: calc(-1 * (var(--sat) + 14px)); z-index: 3; margin: calc(-1 * (var(--sat) + 14px)) -20px 0;
  padding: calc(var(--sat) + 6px) 12px 6px; display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 0.5px solid transparent; transition: border-color .2s;
}
.nav-bar.scrolled { border-bottom-color: var(--rule-2); }
.nav-bar .back { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--lav-ink); font-weight: 600; padding: 8px 8px 8px 2px; min-height: 44px; }
.nav-bar .nav-title { flex: 1; text-align: center; font-weight: 650; font-size: 16px; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-bar.scrolled .nav-title { opacity: 1; }
.nav-bar .spacer { width: 72px; display: flex; justify-content: flex-end; }

/* ------------------------------------------------------------ tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 6px calc(var(--sar) + 8px) calc(var(--sab) + 6px) calc(var(--sal) + 8px);
  background: color-mix(in srgb, var(--ivory) 88%, transparent); backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 0.5px solid var(--rule-2);
}
.tabbar-row { max-width: 620px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, 1fr) 76px repeat(2, 1fr) 1fr; align-items: end; }
.tabbar-row { grid-template-columns: 1fr 1fr 72px 1fr 1fr 1fr; }
.tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 2px; color: var(--ink-3); font: 600 10.5px/1 var(--sans); letter-spacing: .01em; min-height: 50px; justify-content: center; }
.tab .ico { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--lav-ink); }
.fab {
  justify-self: center; align-self: center; width: 58px; height: 58px; margin-top: -22px; border-radius: 22px; border: 0;
  background: var(--ink); color: var(--paper); display: grid; place-items: center; box-shadow: var(--shadow-2);
}
:root[data-theme="dark"] .fab { background: var(--lav); color: #1b1420; }
.fab .ico { width: 28px; height: 28px; }
.fab:active, .btn:active, .quick:active, .tile:active { transform: scale(.96); }
.fab, .btn, .quick, .tile { transition: transform .16s cubic-bezier(.2,.8,.2,1); }

/* ------------------------------------------------------------ surfaces */
.card { background: var(--ivory); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-1); min-width: 0; }
.card.flat { box-shadow: none; border: 1px solid var(--rule); }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { border: 0; background: none; color: var(--lav-ink); font-weight: 600; font-size: 14.5px; padding: 6px 0; min-height: 36px; }
.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* rows: a diary line rather than a card */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-top: 1px solid var(--rule); min-height: 56px; text-align: left; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit; }
.row:first-child { border-top: 0; }
button.row:active { background: var(--lav-wash); }
.row .grow { flex: 1; min-width: 0; }
.row .r-title { font-weight: 600; }
.row .r-sub { color: var(--ink-2); font-size: 13.5px; }
.row .r-time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; min-width: 44px; }
.row .chev { color: var(--ink-3); width: 18px; height: 18px; }
.badge { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.badge .ico { width: 21px; height: 21px; }
.t-feed { background: var(--rose-soft); color: var(--rose-ink); }
.t-sleep { background: var(--sky-soft); color: var(--sky-ink); }
.t-diaper { background: var(--sage-soft); color: var(--sage-ink); }
.t-health { background: var(--honey-soft); color: var(--honey-ink); }
.t-growth, .t-memory, .t-milestone { background: var(--lav-soft); color: var(--lav-ink); }
.who { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.c-lavanda { background: var(--lav); } .c-rosa { background: var(--rose); } .c-salvia { background: var(--sage); } .c-miel { background: var(--honey); } .c-cielo { background: var(--sky); } .c-ciruela { background: #6b4a72; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--lav-soft); color: var(--lav-ink); font-size: 12.5px; font-weight: 600; }
.pill.pro { background: var(--sky-soft); color: var(--sky-ink); }
.pill.pending { background: var(--honey-soft); color: var(--honey-ink); }

/* ------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 16px; border: 0; font-weight: 650; font-size: 16px; }
.btn.primary { background: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .btn.primary { background: var(--lav); color: #1b1420; }
.btn.soft { background: var(--lav-soft); color: var(--lav-ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule-2); }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--rule-2); }
.btn.block { width: 100%; }
.btn.saved { background: var(--sage); color: #fff; }
.btn:disabled { opacity: .45; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px; border: 0; background: var(--lav-wash); color: var(--ink-2); flex: none; }
.btn-row { display: flex; gap: 10px; } .btn-row > * { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--ink-3); }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="password"], input[type="search"], textarea, select {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--rule-2); background: var(--ivory-2);
  font-size: 16px; /* 16 px or more keeps iOS from zooming in */ color: var(--ink); appearance: none; -webkit-appearance: none;
}
input[type="date"], input[type="time"], input[type="datetime-local"] { display: block; line-height: 24px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--lav); outline: none; box-shadow: 0 0 0 3px var(--lav-soft); }
.form { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .two > * { min-width: 0; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--lav-wash); border-radius: 16px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border: 0; background: transparent; border-radius: 12px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; padding: 0 12px; }
.seg button[aria-checked="true"] { background: var(--ivory); color: var(--ink); box-shadow: var(--shadow-1); }
input[type="range"] { width: 100%; accent-color: var(--lav); height: 36px; }

/* ------------------------------------------------------------ sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.sheet-back { position: absolute; inset: 0; background: rgba(28, 18, 32, 0.42); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: var(--kb); margin: 0 auto; max-width: 640px;
  max-height: calc(100% - var(--sat) - 24px - var(--kb)); display: flex; flex-direction: column;
  background: var(--paper); border-radius: 30px 30px 0 0; box-shadow: var(--shadow-2);
  padding: 8px calc(var(--sar) + 20px) calc(var(--sab) + 18px) calc(var(--sal) + 20px);
  transition: bottom .25s ease;
}
.sheet.tall { height: calc(100% - var(--sat) - 24px - var(--kb)); }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--rule-2); margin: 2px auto 8px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0 12px; touch-action: none; flex: none; }
.sheet-title { font: 400 27px/1.1 var(--serif); margin: 0; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; padding-bottom: 4px; margin: 0 -4px; padding-left: 4px; padding-right: 4px; }

/* ------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--sab) + var(--tab-h) + 18px); z-index: 60; margin: 0 auto; max-width: 460px;
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 18px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); font-weight: 600; font-size: 14.5px;
}
.toast span { flex: 1; }
.toast button { border: 0; background: none; color: var(--lav-soft); font-weight: 700; padding: 6px 4px; }
:root[data-theme="dark"] .toast { background: var(--ivory); color: var(--ink); }
:root[data-theme="dark"] .toast button { color: var(--lav-ink); }
.toast.warn { background: var(--warn); color: #fff; }

/* ------------------------------------------------------------ home */
.greet { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; border: 0; flex: none; }
.cover {
  position: relative; display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: end;
}
.cover-photo {
  width: 132px; height: 164px; border-radius: 66px 66px 22px 22px; overflow: hidden; background: var(--lav-soft); position: relative; border: 0; padding: 0;
  box-shadow: var(--shadow-2);
}
.cover-photo img { width: 100%; height: 100%; object-fit: cover; }
.cover-photo .ph-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--lav-ink); }
.ribbon { position: absolute; top: -6px; right: 18px; width: 16px; height: 46px; background: var(--lav); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
.cover-text { padding-bottom: 6px; min-width: 0; }
.cover-text .display { font-size: clamp(46px, 13vw, 64px); }
.cover-age { font: italic 400 20px/1.25 var(--serif); color: var(--ink-2); margin-top: 6px; }
.celebrate { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; padding: 7px 12px; border-radius: 999px; background: var(--rose-soft); color: var(--rose-ink); font-weight: 650; font-size: 13.5px; }

.today { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--ivory); border-radius: var(--r-md); padding: 14px 12px; box-shadow: var(--shadow-1); min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stat .v { font: 400 28px/1 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .v small { font: 600 13px var(--sans); color: var(--ink-2); margin-left: 2px; }
.stat .l { font-size: 12px; font-weight: 650; color: var(--ink-2); letter-spacing: .02em; }
.stat .s { font-size: 12px; line-height: 1.3; color: var(--ink-3); }
.quicks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick { border: 0; border-radius: var(--r-md); padding: 14px 4px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 650; font-size: 13px; }
.quick .ico { width: 28px; height: 28px; }
.live {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); color: var(--ink);
  background: var(--sky-soft); border: 0; width: 100%; text-align: left;
}
.live.feed { background: var(--rose-soft); }
.live .t { font: 400 30px/1 var(--serif); font-variant-numeric: tabular-nums; }
.live .grow { flex: 1; min-width: 0; }
.live .btn { min-height: 42px; padding: 0 14px; font-size: 14px; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: .7; flex: none; }
@media (prefers-reduced-motion: no-preference) { .pulse-dot { animation: breathe 2.8s ease-in-out infinite; } }
@keyframes breathe { 50% { transform: scale(.6); opacity: .35; } }

.memory-card { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; background: var(--ivory); border-radius: var(--r-md); padding: 10px; box-shadow: var(--shadow-1); border: 0; text-align: left; width: 100%; }
.memory-card .thumb { width: 96px; height: 96px; border-radius: 14px; overflow: hidden; background: var(--lav-soft); display: grid; place-items: center; color: var(--lav-ink); }
.memory-card .thumb img, .memory-card .thumb video { width: 100%; height: 100%; object-fit: cover; }
.quote { font: italic 400 19px/1.3 var(--serif); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.event-row .datebox { width: 46px; text-align: center; flex: none; }
.event-row .datebox b { display: block; font: 400 24px/1 var(--serif); }
.event-row .datebox span { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-2); letter-spacing: .08em; }
.note-card { background: var(--honey-soft); color: var(--honey-ink); border-radius: var(--r-md); padding: 16px; }
.note-card .quote { color: var(--ink); }
.install-card { background: var(--lav-soft); border-radius: var(--r-md); padding: 16px; display: flex; gap: 14px; align-items: flex-start; }
.signature { text-align: center; color: var(--ink-3); font: italic 400 16px/1.4 var(--serif); padding: 18px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.signature .ico { width: 18px; height: 18px; color: var(--rose); }

/* ------------------------------------------------------------ routines */
.daybar { display: flex; align-items: center; gap: 8px; }
.daybar .lbl { flex: 1; text-align: center; font-weight: 650; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--rule-2); background: transparent; border-radius: 999px; padding: 0 14px; min-height: 38px; font-weight: 600; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--lav); color: #1b1420; border-color: var(--lav); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 18px; }
.bars .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; font-size: 11.5px; color: var(--ink-2); font-weight: 650; font-variant-numeric: tabular-nums; min-width: 0; }
.bars .stack { width: 100%; max-width: 30px; display: flex; flex-direction: column-reverse; border-radius: 9px; overflow: hidden; transform-origin: bottom; }
.bars .stack i { display: block; width: 100%; }
.bars .c.today { color: var(--ink); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* big choice tiles for quick logging */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tiles.two-col { grid-template-columns: repeat(2, 1fr); }
.tile { border: 0; border-radius: var(--r-md); padding: 16px 8px; min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 14.5px; text-align: center; }
.tile .ico { width: 30px; height: 30px; }
.tile small { font-weight: 500; font-size: 12px; opacity: .8; }
.tile[aria-pressed="true"] { outline: 2.5px solid currentColor; outline-offset: -2.5px; }
.timer-big { text-align: center; padding: 8px 0 4px; }
.timer-big .t { font: 400 64px/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ------------------------------------------------------------ memories */
.timeline { position: relative; display: flex; flex-direction: column; gap: 18px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1.5px; background: linear-gradient(var(--rule-2), var(--rule-2)) ; }
.tl-month { font: 400 24px/1.1 var(--serif); margin: 8px 0 -4px -26px; }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -24px; top: 18px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--lav); }
.tl-item.first::before { background: var(--lav); }
.mem { background: var(--ivory); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-1); }
.mem .media { display: grid; gap: 2px; grid-template-columns: repeat(2, 1fr); background: var(--rule); }
.mem .media.one { grid-template-columns: 1fr; }
.mem .media button { border: 0; padding: 0; background: var(--lav-soft); aspect-ratio: 1; overflow: hidden; position: relative; }
.mem .media.one button { aspect-ratio: 4 / 3; }
.mem .media.three button:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }
.mem .media img, .mem .media video { width: 100%; height: 100%; object-fit: cover; }
.mem .media .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.mem .media .play .ico { width: 44px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.mem .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.mem .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.mem .word { font: italic 400 30px/1.1 var(--serif); }
.mem .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.envelope { position: relative; background: var(--ivory); border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow-1); display: flex; gap: 14px; align-items: center; border: 0; width: 100%; text-align: left; overflow: hidden; }
.envelope::after { content: ""; position: absolute; inset: 0 0 auto; height: 58%; background: linear-gradient(to bottom right, transparent 49.6%, var(--rule) 50%, transparent 50.4%), linear-gradient(to bottom left, transparent 49.6%, var(--rule) 50%, transparent 50.4%); pointer-events: none; }
.wax { width: 46px; height: 46px; border-radius: 50%; background: var(--rose); color: #fff; display: grid; place-items: center; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); position: relative; z-index: 1; }
.letter-paper { background: var(--ivory); border-radius: var(--r-md); padding: 22px 20px; box-shadow: var(--shadow-1); font: 400 19px/1.55 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.ms-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ms { border: 1px solid var(--rule-2); background: var(--ivory); border-radius: var(--r-md); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.ms .ico { color: var(--ink-3); }
.ms.done { background: var(--lav-soft); border-color: transparent; }
.ms.done .ico { color: var(--lav-ink); }
.ms b { font-weight: 650; font-size: 14.5px; line-height: 1.3; }
.ms small { color: var(--ink-2); font-size: 12.5px; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--r-md); overflow: hidden; }
.month-grid button { border: 0; padding: 0; aspect-ratio: 1; background: var(--lav-soft); overflow: hidden; }
.month-grid img, .month-grid video { width: 100%; height: 100%; object-fit: cover; }
.month-cover { position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4 / 3; background: var(--lav-soft); border: 0; padding: 0; width: 100%; }
.month-cover img { width: 100%; height: 100%; object-fit: cover; }
.month-cover .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 16px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(20, 12, 24, .62)); }
.month-cover .cap .h2 { color: #fff; }
.month-cover.nophoto { aspect-ratio: 5 / 2; }
.month-cover.nophoto .cap { background: none; color: var(--ink-2); }
.month-cover.nophoto .cap .h2 { color: var(--ink); }
.month-cover.nophoto > span:first-child { justify-content: end; padding: 18px; place-items: start end; }

/* photo viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: #0d090f; display: flex; flex-direction: column; }
.viewer .vbar { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--sat) + 8px) 14px 8px; color: #fff; position: relative; z-index: 2; }
.viewer .vbar .icon-btn { background: rgba(255,255,255,.12); color: #fff; }
.viewer .stage { flex: 1; display: grid; place-items: center; min-height: 0; padding-bottom: var(--sab); }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ------------------------------------------------------------ growth chart */
.chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart text { fill: var(--ink-3); font: 500 11px var(--sans); }
.chart .lbl { fill: var(--ink); font-weight: 700; font-size: 12.5px; }
.tip { position: absolute; transform: translate(-50%, -100%); background: var(--ink); color: var(--paper); padding: 6px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 650; white-space: nowrap; pointer-events: none; }
.compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ------------------------------------------------------------ more */
.me-card { display: flex; align-items: center; gap: 14px; }
.me-card .avatar { width: 54px; height: 54px; font-size: 20px; }
.group { background: var(--ivory); border-radius: var(--r-md); box-shadow: var(--shadow-1); padding: 0 16px; }
.group .row { padding: 12px 0; }

/* ------------------------------------------------------------ night */
.night { position: fixed; inset: 0; z-index: 40; color: #f6dfc4; background: #0b0706; display: flex; flex-direction: column; overflow-y: auto; padding: calc(var(--sat) + 10px) calc(var(--sar) + 20px) calc(var(--sab) + 20px) calc(var(--sal) + 20px); }
.night .glow { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(60% 45% at 50% 30%, rgba(233, 150, 72, var(--glow, .4)), rgba(120, 60, 20, calc(var(--glow, .4) * .35)) 55%, transparent 80%); transition: opacity .6s; }
.night > * { position: relative; }
.night h1 { font: italic 400 38px/1.05 var(--serif); margin: 10px 0 2px; color: #fbe6cc; }
.night .nclock { font: 400 64px/1 var(--serif); font-variant-numeric: tabular-nums; color: #fbe6cc; opacity: .85; text-align: center; margin: 26px 0 6px; }
.night .ntiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.night .ntile { border: 1px solid rgba(246, 223, 196, .14); background: rgba(246, 223, 196, .05); color: #f6dfc4; border-radius: 24px; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 16px; }
.night .ntile .ico { width: 32px; height: 32px; }
.night .ntile:last-child:nth-child(odd) { grid-column: span 2; min-height: 72px; flex-direction: row; }
.night details summary { cursor: pointer; font-weight: 650; min-height: 32px; }
.night .ntile[aria-pressed="true"] { background: rgba(233, 166, 94, .22); border-color: rgba(233, 166, 94, .55); }
.night .nrow { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.night .nrow label { font-weight: 650; min-width: 88px; }
.night input[type="range"] { accent-color: #e9a65e; height: 44px; }
.night .ntimer { display: flex; gap: 8px; }
.night .ntimer button { flex: 1; min-height: 48px; border-radius: 16px; border: 1px solid rgba(246, 223, 196, .16); background: transparent; color: #f6dfc4; font-weight: 650; }
.night .ntimer button[aria-pressed="true"] { background: rgba(233, 166, 94, .22); border-color: rgba(233, 166, 94, .55); }
.night .nclose { border: 0; background: rgba(246, 223, 196, .08); color: #f6dfc4; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; }
.night .nnote { color: rgba(246, 223, 196, .6); font-size: 13px; line-height: 1.5; margin-top: 18px; }

/* ------------------------------------------------------------ login & launch */
.gate { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--sat) + 24px) 24px calc(var(--sab) + 24px); background: var(--paper); overflow-y: auto; }
.gate .inner { max-width: 400px; gap: 18px; }
.monogram { width: 92px; height: 92px; margin: 0 auto 6px; position: relative; }
/* Same spot as the iOS launch image (centre at 44 % of the height), so the hand-off is seamless. */
.launch { position: fixed; inset: 0; z-index: 80; background: var(--paper); }
.launch .monogram { position: absolute; left: 50%; top: 44%; width: 120px; height: 120px; margin: -60px 0 0 -60px; }
.launch .launch-name { position: absolute; left: 0; right: 0; top: calc(44% + 60px + 6px); text-align: center; font: 400 44px/1 var(--serif); color: #2e2433; }
:root[data-theme="dark"] .launch { background: #f7f1e8; }
.gate .monogram { border-radius: 30px; box-shadow: var(--shadow-2); }
.skeleton { background: linear-gradient(100deg, var(--lav-wash) 30%, var(--ivory) 50%, var(--lav-wash) 70%); background-size: 300% 100%; border-radius: var(--r-md); }
@media (prefers-reduced-motion: no-preference) { .skeleton { animation: shimmer 1.6s ease-in-out infinite; } }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ------------------------------------------------------------ empty & misc */
.empty { text-align: center; padding: 22px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-ill { width: 72px; height: 72px; border-radius: 26px; background: var(--lav-wash); display: grid; place-items: center; color: var(--lav); margin-bottom: 6px; }
.empty-title { font: 400 22px/1.2 var(--serif); margin: 0; }
.empty-text { color: var(--ink-2); margin: 0; font-size: 14.5px; max-width: 34ch; }
.status-strip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.progress { height: 6px; border-radius: 6px; background: var(--lav-soft); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--lav); border-radius: 6px; transform-origin: left; }
.kbd-safe { height: 4px; }
@media (min-width: 700px) {
  .screen { padding-left: 32px; padding-right: 32px; }
  .today { gap: 14px; }
}

/* iOS-style switch */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 31px; background: var(--rule-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .22s cubic-bezier(.3,.7,.3,1); }
.switch:checked { background: var(--sage-ink); }
:root[data-theme="dark"] .switch:checked { background: var(--lav); }
.switch:checked::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
