/* Small Space — "before sunrise" */

@font-face { font-family: 'Literata'; font-style: normal; font-weight: 300; font-display: swap; src: url(../fonts/literata-latin-300-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/literata-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-400-italic.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 300; font-display: swap; src: url(../fonts/literata-latin-ext-300-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/literata-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-ext-400-italic.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --mist: #E6ECEF;
  --paper: #F6F8F8;
  --ink: #1F2B38;
  --ink-soft: #5B6976;
  --line: #CBD5DB;
  --lamp: #E9C46A;
  --lamp-wash: #F7EBC9;
  --focus: #2F6F9F;
  --danger: #A23B3B;
  --serif: "Literata", Georgia, "Iowan Old Style", "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --r-page: 22px;
  --r-chip: 999px;
  color-scheme: light;
}
/* Mist follows the system's dark setting, or an explicit data-theme="dark" on the page. */
@media (prefers-color-scheme: dark) {
  :root[data-style="mist"]:not([data-theme="light"]) {
    --mist: #121820; --paper: #1A222C; --ink: #E7ECEF; --ink-soft: #9AA7B2; --line: #2E3946;
    --lamp-wash: #2A2618; --focus: #8CC2EA; --danger: #E08A8A;
    color-scheme: dark;
  }
}
:root[data-style="mist"][data-theme="dark"] {
  --mist: #121820; --paper: #1A222C; --ink: #E7ECEF; --ink-soft: #9AA7B2; --line: #2E3946;
  --lamp-wash: #2A2618; --focus: #8CC2EA; --danger: #E08A8A;
  color-scheme: dark;
}
/* Paper styles (Plus). A chosen style stays as chosen, day and night. */
:root[data-style="paper"] { --mist: #EFE9DF; --paper: #FBF8F2; --ink: #2B2622; --ink-soft: #6E655C; --line: #DCD3C6; --lamp-wash: #F6E7C3; --focus: #7A4E1F; }
:root[data-style="sage"]  { --mist: #E3EAE3; --paper: #F4F7F3; --ink: #213027; --ink-soft: #5A6B60; --line: #C9D5CB; --lamp-wash: #EFEBC8; --focus: #2F6B4A; }
:root[data-style="rose"]  { --mist: #F1E6E6; --paper: #FBF6F5; --ink: #3A2A2C; --ink-soft: #7A6265; --line: #E2CFD0; --lamp-wash: #F7E5CC; --focus: #8E3B4A; }
:root[data-style="night"] { --mist: #0E131A; --paper: #161D26; --ink: #E4E9EE; --ink-soft: #93A0AC; --line: #283240; --lamp-wash: #29251A; --focus: #8CC2EA; --danger: #E08A8A; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--mist); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.5; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--paper); padding: 8px 12px; z-index: 50; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg.fill { fill: currentColor; stroke: none; }
.noscript { padding: 24px; font-family: var(--serif); }

/* ---------- Top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; max-width: 640px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px 6px; }
.brand { border: 0; background: none; padding: 6px 0; font-family: var(--serif); font-size: 1.05rem; font-weight: 500; letter-spacing: 0.01em; }
.bar-nav { display: flex; gap: 2px; }
.nav-btn { border: 0; background: none; padding: 8px 12px; border-radius: var(--r-chip); color: var(--ink-soft); font-size: 0.95rem; min-height: 40px; }
.nav-btn[aria-current="page"] { color: var(--ink); background: var(--paper); }
.icon-btn { display: grid; place-items: center; padding: 8px 10px; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); outline: none; }

/* ---------- Write ---------- */
.composer { margin-top: 18px; }
.date-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.date { font-family: var(--serif); font-weight: 300; font-size: clamp(2.1rem, 8vw, 3.1rem); line-height: 1.05; letter-spacing: -0.015em; margin: 0; }
.date-change { position: relative; color: var(--ink-soft); font-size: 0.9rem; }
.date-change input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.date-change-label { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.date-change:focus-within .date-change-label { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.page {
  display: block; width: 100%; margin-top: 18px; min-height: 11.5rem; resize: none; overflow: hidden;
  padding: 22px 22px 26px; background: var(--paper); border: 1px solid transparent; border-radius: var(--r-page);
  font-family: var(--serif); font-size: 1.18rem; line-height: 1.7;
  background-image: linear-gradient(to bottom, transparent calc(1.7em - 1px), color-mix(in srgb, var(--line) 55%, transparent) calc(1.7em - 1px), color-mix(in srgb, var(--line) 55%, transparent) 1.7em);
  background-size: 100% 1.7em; background-position: 0 22px; background-attachment: local;
}
.page::placeholder { color: var(--ink-soft); opacity: 0.85; }
.page:focus { outline: none; border-color: var(--line); }
.under-page { display: flex; justify-content: flex-end; margin-top: 6px; }

.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.thumb { position: relative; width: 84px; height: 84px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }
.thumb-x {
  position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 0.95rem; line-height: 1;
}
.clip { display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: var(--r-chip); padding: 4px 6px 4px 12px; }
.clip audio { height: 36px; max-width: 220px; }

.mood { border: 0; padding: 0; margin: 14px 0 0; }
.mood legend { color: var(--ink-soft); font-size: 0.9rem; padding: 0; margin-bottom: 6px; }
.optional { opacity: 0.7; }
.mood-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mood-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: transparent; border-radius: var(--r-chip);
  min-width: 44px; height: 44px; padding: 0 11px; font-size: 0.9rem; color: var(--ink-soft);
}
.mood-btn .glyph { font-size: 1.15rem; line-height: 1; }
.mood-btn .mood-label { display: none; }
.mood-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); padding: 0 14px 0 11px; }
.mood-btn[aria-pressed="true"] .mood-label { display: inline; }

.composer-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.draft-note { flex: 1 1 auto; min-width: 0; color: var(--ink-soft); font-size: 0.85rem; text-align: right; }
.keep {
  margin-left: auto; border: 0; background: var(--ink); color: var(--paper); border-radius: var(--r-chip);
  padding: 12px 30px; min-height: 48px; font-family: var(--serif); font-size: 1.08rem; font-weight: 500;
  transition: transform 120ms ease, opacity 120ms ease;
}
.keep:active { transform: scale(0.97); }
.keep:disabled { opacity: 0.35; cursor: default; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; border: 1px solid var(--line); background: transparent;
  border-radius: var(--r-chip); padding: 8px 14px; min-height: 44px; font-size: 0.92rem; text-decoration: none; color: inherit;
}
.chip:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-quiet { color: var(--ink-soft); border-color: transparent; }
.chip-solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.icon-chip { padding: 0; width: 44px; justify-content: center; position: relative; }
.plus-tag {
  position: absolute; top: -7px; right: -10px; font-size: 0.65rem; font-weight: 600; letter-spacing: 0.02em;
  background: var(--lamp); color: #2a2410; border-radius: 6px; padding: 1px 5px;
}
#seal-toggle[aria-pressed="true"] { background: var(--lamp-wash); border-color: var(--lamp); color: var(--ink); }
.link { border: 0; background: none; padding: 6px 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); min-height: 32px; }
.link.quiet { color: var(--ink-soft); font-size: 0.9rem; }
a { color: inherit; }

.seal { margin-top: 16px; padding: 14px 16px 16px; border: 1px dashed var(--line); border-radius: 16px; }
.seal-hint { margin: 0 0 10px; color: var(--ink-soft); font-size: 0.9rem; }
.seal-row { display: flex; flex-wrap: wrap; gap: 8px; }
.overlay-host { position: relative; }
.overlay-input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* Gentle banners (one at a time) */
.banner-slot:empty { display: none; }
.banner {
  margin-top: 14px; padding: 16px 18px; border-radius: 18px; background: var(--paper);
  display: grid; gap: 8px;
}
.banner p { margin: 0; }
.banner .banner-title { font-family: var(--serif); font-size: 1.08rem; }
.banner .banner-text { color: var(--ink-soft); font-size: 0.93rem; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.banner.care { background: var(--lamp-wash); }
.helpline { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- The memory: a postcard from yourself ---------- */
.memory { margin-top: 44px; }
.memory-title { font-family: var(--serif); font-weight: 400; font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.memory-title::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 0 5px color-mix(in srgb, var(--lamp) 28%, transparent); flex: none; }
.memory-card {
  position: relative; cursor: pointer; background: var(--lamp-wash); border-radius: 6px 22px 22px 22px;
  padding: 22px 22px 18px; transform: rotate(-0.6deg);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--lamp) 60%, transparent), 0 14px 30px -22px color-mix(in srgb, var(--ink) 60%, transparent);
}
.memory-card:focus-visible { outline-offset: 4px; }
.memory-card .when { color: var(--ink-soft); font-size: 0.85rem; margin: 0 0 8px; }
.memory-card .text { font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.memory-card img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; display: block; }
.memory-card .mood-tag { margin-top: 10px; color: var(--ink-soft); font-size: 0.85rem; }
.memory-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 12px; }
.year-link { margin: 18px 0 0; }

/* ---------- Lists ---------- */
.today { margin-top: 44px; }
.section-title, .month-title { font-family: var(--serif); font-weight: 400; font-size: 1.05rem; margin: 0 0 6px; color: var(--ink-soft); }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-item { display: grid; grid-template-columns: 4.4rem 1fr auto; gap: 14px; align-items: start; width: 100%; text-align: left; border: 0; background: none; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.note-item:hover .note-text { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.note-when { color: var(--ink-soft); font-size: 0.85rem; padding-top: 3px; }
.note-when b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.4rem; color: var(--ink); line-height: 1.1; }
.note-when.same-day { visibility: hidden; }
.note-text { font-family: var(--serif); font-size: 1.02rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.note-side { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.sealed-line { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-style: italic; }
.sealed-line svg { flex: none; }
.just-kept { animation: settle 900ms ease-out; }
@keyframes settle { from { background: color-mix(in srgb, var(--lamp) 30%, transparent); } to { background: transparent; } }

/* ---------- Moments ---------- */
.view-title { font-family: var(--serif); font-weight: 300; font-size: clamp(2rem, 7vw, 2.8rem); letter-spacing: -0.015em; margin: 18px 0 14px; }
.view-sub { color: var(--ink-soft); margin: -6px 0 22px; }
.year-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.year-chips:empty { display: none; }
.search { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: var(--r-chip); padding: 4px 16px; margin-bottom: 26px; color: var(--ink-soft); }
.search input { flex: 1; border: 0; background: none; padding: 10px 0; outline: none; color: var(--ink); min-width: 0; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.month { margin-bottom: 30px; }
.empty { color: var(--ink-soft); font-family: var(--serif); font-size: 1.1rem; }

/* ---------- One moment ---------- */
.back { margin-top: 16px; color: var(--ink-soft); }
.note-full { margin-top: 18px; background: var(--paper); border-radius: var(--r-page); padding: 26px 24px 30px; }
.note-full-date { color: var(--ink-soft); margin: 0 0 14px; }
.note-full .text { font-family: var(--serif); font-size: 1.2rem; line-height: 1.75; white-space: pre-wrap; margin: 0; max-width: 60ch; overflow-wrap: anywhere; }
.gallery { display: grid; gap: 8px; margin-bottom: 18px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.gallery.single { grid-template-columns: 1fr; }
.gallery button { padding: 0; border: 0; background: var(--mist); border-radius: 14px; overflow: hidden; cursor: zoom-in; }
.gallery img { display: block; width: 100%; height: 100%; max-height: 70vh; object-fit: cover; aspect-ratio: 1; }
.gallery.single img { aspect-ratio: auto; object-fit: contain; }
.note-full audio { width: 100%; margin-bottom: 16px; }
.note-full .mood-tag { color: var(--ink-soft); margin-top: 16px; font-size: 0.92rem; }
.note-full textarea.page { margin-top: 0; min-height: 30vh; }
.note-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.sealed-box { text-align: center; padding: 30px 10px 10px; }
.sealed-box svg { stroke: var(--ink-soft); stroke-width: 1.2; }
.sealed-box p { font-family: var(--serif); font-size: 1.15rem; margin: 12px 0 4px; }
.sealed-box .sub { color: var(--ink-soft); font-family: var(--sans); font-size: 0.92rem; }

/* ---------- Year in moments ---------- */
.year-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
.year-card { width: 100%; height: 100%; text-align: left; border: 0; background: var(--paper); border-radius: 16px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.year-card .m { font-family: var(--serif); font-size: 1rem; }
.year-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.year-card .t { font-family: var(--serif); font-size: 0.95rem; line-height: 1.45; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Your space ---------- */
.setting { padding: 20px 0 22px; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting h2 { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; margin: 0 0 4px; }
.setting p { color: var(--ink-soft); margin: 0 0 12px; max-width: 60ch; }
.setting .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.setting .hint { font-size: 0.85rem; margin-top: 10px; }
.plan-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.plan-badge { font-family: var(--serif); font-size: 1.4rem; }
.badge { font-size: 0.75rem; font-weight: 600; border-radius: 6px; padding: 2px 7px; background: var(--lamp); color: #2a2410; }
.badge.test { background: transparent; border: 1px dashed var(--ink-soft); color: var(--ink-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: grid; justify-items: center; gap: 6px; border: 0; background: none; padding: 4px; font-size: 0.85rem; color: var(--ink-soft); position: relative; }
.swatch i { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.swatch[aria-pressed="true"] i { outline: 2px solid var(--ink); outline-offset: 3px; }
.swatch .plus-tag { top: -2px; right: -4px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; cursor: pointer; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background 150ms; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); transition: transform 150ms; box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(20px); }
.field { display: grid; gap: 6px; margin: 0 0 12px; }
.field span { font-size: 0.9rem; color: var(--ink-soft); }
.field input { border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%; }
.field input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.time-input { border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-chip); padding: 8px 14px; min-height: 44px; }
.error { color: var(--danger); font-size: 0.9rem; margin: 6px 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.92rem; }
.version { color: var(--ink-soft); font-size: 0.8rem; margin-top: 18px; }

/* ---------- Sheet (dialog) ---------- */
.sheet {
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  width: min(560px, 100vw); max-width: 100vw; max-height: 92dvh;
  border-radius: 24px; box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.5);
}
.sheet::backdrop { background: rgb(10 14 20 / 0.45); }
.sheet-inner { padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; max-height: 92dvh; }
@media (max-width: 600px) {
  .sheet { margin: auto 0 0; border-radius: 24px 24px 0 0; width: 100vw; }
}
.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin: 0 0 6px; letter-spacing: -0.01em; }
.sheet .lede { color: var(--ink-soft); margin: 0 0 18px; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.sheet .actions .grow { flex: 1; }
.sheet .fine { color: var(--ink-soft); font-size: 0.85rem; margin: 14px 0 0; }
.sheet-close { position: absolute; top: 14px; right: 14px; border: 0; background: var(--mist); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; }
.features { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.features li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.features li::before { content: ""; width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--lamp); }
.features b { font-weight: 600; }
.features span { color: var(--ink-soft); font-size: 0.92rem; display: block; }
.plans { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.plan { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer; }
.plan:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.plan input { accent-color: var(--ink); width: 18px; height: 18px; margin: 0; }
.plan .name { font-weight: 600; }
.plan .sub { color: var(--ink-soft); font-size: 0.85rem; display: block; }
.plan .price { font-family: var(--serif); font-size: 1.05rem; text-align: right; }
.plan .price s { color: var(--ink-soft); font-size: 0.85rem; display: block; }
.card-preview { display: block; width: 100%; border-radius: 14px; background: var(--mist); margin-bottom: 12px; }
.code-input { font-size: 1.6rem !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.rec { display: grid; justify-items: center; gap: 14px; padding: 12px 0; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); display: grid; place-items: center; }
.rec-btn.on { background: var(--danger); }
.rec-time { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-family: var(--serif); }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--ink-soft); }
.steps li { margin-bottom: 6px; }

/* ---------- Lock ---------- */
.lock { position: fixed; inset: 0; z-index: 40; background: var(--mist); display: grid; place-items: center; padding: 24px; }
.lock-inner { display: grid; justify-items: center; gap: 18px; width: min(320px, 100%); }
.lock h1 { font-family: var(--serif); font-weight: 300; font-size: 2rem; margin: 0; }
.dots { display: flex; gap: 14px; height: 18px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); }
.dots i.on { background: var(--ink); }
.dots.shake { animation: shake 300ms; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--paper); font-size: 1.5rem; font-family: var(--serif); }
.keypad button.ghost { background: none; font-family: var(--sans); font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 18px; font-size: 0.95rem; max-width: calc(100vw - 32px); z-index: 60;
}
.toast .link { color: var(--paper); text-decoration-color: currentColor; white-space: nowrap; }

.photo-dialog { border: 0; padding: 12px; border-radius: 18px; background: var(--paper); max-width: min(96vw, 1000px); }
.photo-dialog::backdrop { background: rgb(10 14 20 / 0.7); }
.photo-dialog img { display: block; max-width: 100%; max-height: 80vh; border-radius: 12px; }
.photo-dialog form { text-align: right; margin-top: 10px; }

/* ---------- Who, where, song ---------- */
.details-panel { margin-top: 14px; padding: 14px 16px 16px; border-radius: 16px; background: var(--paper); }
.details-editor { display: grid; gap: 12px; }
.detail-field { display: grid; gap: 6px; }
.detail-label { font-size: 0.85rem; color: var(--ink-soft); }
.detail-field > input, .chip-input {
  border: 1px solid var(--line); background: var(--mist); border-radius: 12px; min-height: 46px; padding: 8px 12px; width: 100%;
}
.detail-field > input:focus, .chip-input:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.chip-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; }
.chip-input input { flex: 1 1 8rem; min-width: 6rem; border: 0; background: none; outline: none; padding: 6px 4px; }
.people-chips { display: contents; }
.person-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 0.9rem; }
.person-chip button { border: 0; background: none; width: 26px; height: 26px; border-radius: 50%; color: var(--ink-soft); font-size: 1rem; line-height: 1; }
.details-summary { margin: 10px 0 0; color: var(--ink-soft); font-size: 0.9rem; overflow-wrap: anywhere; }
#details-toggle[aria-pressed="true"] { background: var(--lamp-wash); border-color: var(--lamp); }
.note-col { display: grid; gap: 4px; min-width: 0; }
.note-meta { color: var(--ink-soft); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-line { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.detail-line .link { min-height: 0; padding: 0; }
.detail-key { color: var(--ink-soft); font-size: 0.85rem; min-width: 3.2rem; }

/* ---------- Moments: list / calendar, filters ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mode-switch { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 3px; }
.mode-btn { border: 0; background: none; border-radius: 999px; padding: 8px 14px; min-height: 38px; color: var(--ink-soft); font-size: 0.9rem; }
.mode-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding: 10px 10px 10px 16px; background: var(--lamp-wash); border-radius: 16px; }
.filter-bar b { font-weight: 600; }
.facets { display: grid; gap: 10px; margin: -8px 0 26px; }
.facets:empty { display: none; }
.facet-row { display: grid; grid-template-columns: 2.4rem 1fr; align-items: center; gap: 8px; min-width: 0; }
.facet-label { color: var(--ink-soft); font-size: 0.85rem; }
.facet-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0; }
.facet-chips::-webkit-scrollbar { display: none; }
.facet-chips.wrap { flex-wrap: wrap; overflow: visible; }
.facet-chips .chip { white-space: nowrap; min-height: 38px; padding: 6px 12px; }
.chip.static { cursor: default; }
.month-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* ---------- Calendar ---------- */
.cal { background: var(--paper); border-radius: 22px; padding: 14px 12px 16px; margin-top: 6px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-head .icon-chip { font-size: 1.3rem; line-height: 1; }
.cal-head .icon-chip:disabled { opacity: 0.3; cursor: default; }
.cal-title { font-family: var(--serif); font-size: 1.2rem; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.cal-title:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-wd { font-size: 0.75rem; color: var(--ink-soft); padding: 4px 0 6px; }
.cal-day-btn {
  position: relative; width: 100%; max-width: 48px; height: auto; aspect-ratio: 1; justify-self: center; align-self: start;
  padding: 0; border: 0; background: none; border-radius: 50%;
  font-variant-numeric: tabular-nums; font-size: 0.95rem; color: var(--ink);
}
.cal-day-btn.has::after { content: ""; position: absolute; left: 50%; bottom: 16%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--lamp); }
.cal-day-btn.is-today { box-shadow: inset 0 0 0 1.5px var(--line); }
.cal-day-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.cal-day-btn:disabled { color: var(--line); cursor: default; }
.cal-day { margin-top: 26px; display: grid; gap: 10px; justify-items: start; }
.cal-day > * { width: 100%; }
.cal-day > .chip { width: auto; }
.cal-hint { color: var(--ink-soft); margin: 0; }
.other-years { margin-top: 18px; }

/* ---------- Month in moments ---------- */
.month-grid { margin-bottom: 8px; }
.month-facet { margin-top: 26px; }
.month-facet .section-title { margin-bottom: 10px; }

/* ---------- Free trial ---------- */
.trial-box { display: grid; gap: 6px; justify-items: start; margin: 4px 0 6px; padding: 14px 16px; border-radius: 16px; background: var(--lamp-wash); }
.trial-box .fine { margin: 0; }
.or { text-align: center; color: var(--ink-soft); font-size: 0.85rem; margin: 14px 0 10px; }
.trial-left { margin: 0 0 14px; }
.yearly-btn[aria-pressed="true"] { background: var(--lamp-wash); border-color: var(--lamp); }

/* ---------- City field ---------- */
.city-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.city-row input { flex: 1 1 12rem; min-width: 0; border: 1px solid var(--line); background: var(--mist); border-radius: 12px; min-height: 46px; padding: 8px 12px; }
.city-row input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.city-results { list-style: none; margin: 4px 0 0; padding: 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; display: grid; }
.city-results button { width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; min-height: 44px; }
.city-results button:hover, .city-results button:focus-visible { background: var(--mist); }
.city-field .hint { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.city-status:empty { display: none; }
.muted { color: var(--ink-soft); }

/* ---------- Your world ---------- */
.world-chip { gap: 8px; }
.globe-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lamp) 25%, transparent); }
.world-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.zoom-row { display: flex; gap: 8px; }
.zoom-row .icon-chip { font-size: 1.25rem; }
.globe-stage { position: relative; max-width: 520px; margin: 0 auto; }
.globe-stage.flat { max-width: none; }
.globe { display: block; width: 100%; touch-action: none; cursor: grab; border-radius: 50%; }
.globe-stage.flat .globe { border-radius: 16px; }
.globe:active { cursor: grabbing; }
.globe-stage.locked .globe { filter: blur(5px) saturate(0.9); cursor: default; }
.globe-lock { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 24px; }
.globe-lock > * { position: relative; }
.globe-lock::before { content: ""; position: absolute; left: 50%; top: 50%; width: min(78%, 340px); height: 190px; transform: translate(-50%, -50%); border-radius: 24px; background: color-mix(in srgb, var(--mist) 78%, transparent); }
.globe-lock .banner-title { font-family: var(--serif); font-size: 1.25rem; margin: 0; }
.globe-lock .banner-text { color: var(--ink-soft); margin: 0 0 6px; }
.world-sub { text-align: center; margin: 14px 0 22px; }
.world-list { display: grid; gap: 18px; }
.world-country .section-title { margin-bottom: 8px; }
.world-country .chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.world-country .chip[aria-pressed="true"] .muted { color: inherit; opacity: 0.7; }
.world-detail { margin: 0 0 28px; display: grid; gap: 18px; padding: 18px; border-radius: 22px; background: var(--paper); }
.world-detail:empty { display: none; }
.world-city { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin: 0; }
.world-place .section-title { font-size: 0.95rem; margin-bottom: 0; }

@media (min-width: 720px) { main { padding-top: 24px; } .composer { margin-top: 32px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .memory-card { transform: none; }
}

/* ---------- Sign in with Google / Apple ---------- */
/* Same size and weight for both (Apple asks that its button is at least as prominent as others).
   Before launch, add each company's official mark from their branding pages (see README). */
.provider-list { display: grid; gap: 10px; }
.provider-btn { justify-content: center; width: 100%; min-height: 48px; font-size: 1rem; font-weight: 500; }
.provider-apple { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.provider-google { background: var(--paper); border-color: var(--line); }
.provider-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* A date field shown in place, for browsers that can't open their picker from a click (see enhancePicker) */
.picker-shown > input[type="date"], .picker-shown > input[type="month"] {
  position: static; opacity: 1; width: auto; margin-left: 8px; padding: 4px 8px; min-height: 36px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit;
}
.date-change.picker-shown { display: inline-flex; align-items: center; flex-direction: row-reverse; gap: 4px; }
