/* Bricolage Grotesque and Instrument Sans (SIL OFL, see fonts/), cut down to
   their narrowest width and the weights used here, so labels fit more words. */
@font-face { font-family: "Bricolage Grotesque"; font-weight: 500 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin.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: "Bricolage Grotesque"; font-weight: 500 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-weight: 400 700; font-display: swap; src: url(fonts/instrument-sans-latin.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: "Instrument Sans"; font-weight: 400 700; font-display: swap; src: url(fonts/instrument-sans-latin-ext.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #eef0f5; --surface: #f8f9fc; --ink: #1c2233; --muted: #5f6780; --line: #d2d7e2; --faint: #b9bfcd;
  --press: #1c2233; --on-press: #f8f9fc; --danger: #b23a24;
  /* Season colours for blurs, and darker inks for text that has to be read. */
  --winter: #5f78d0; --spring: #4f9f7c; --summer: #e0704e; --fall: #c48a2a; --unsure: #8d94a8;
  --winter-ink: #3f58b8; --spring-ink: #2c7656; --summer-ink: #b2482a; --fall-ink: #87600f; --unsure-ink: #5c637a;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, "Hiragino Sans", "Noto Sans CJK JP", "Noto Naskh Arabic", "Noto Sans Devanagari", sans-serif;
  --body: "Instrument Sans", "Arial Narrow", system-ui, "Hiragino Sans", "Noto Sans CJK JP", "Noto Naskh Arabic", "Noto Sans Devanagari", sans-serif;
  --meta: "Instrument Sans", "Arial Narrow", system-ui, "Hiragino Sans", "Noto Sans CJK JP", "Noto Naskh Arabic", "Noto Sans Devanagari", sans-serif;
  --sab: var(--random-nav-h, env(safe-area-inset-bottom, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f121a; --surface: #181c26; --ink: #e8ebf3; --muted: #8c94a9; --line: #2a303f; --faint: #4a5163;
    --press: #e8ebf3; --on-press: #181c26; --danger: #f08a73;
    --winter: #8ea1ec; --spring: #74c49f; --summer: #f08f6d; --fall: #e0ad55; --unsure: #6f7690;
    --winter-ink: #8ea1ec; --spring-ink: #74c49f; --summer-ink: #f08f6d; --fall-ink: #e0ad55; --unsure-ink: #a3a9bc;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding: 150px 0 calc(110px + var(--sab)); }
/* Follow the iPhone/iPad text size setting. */
@supports (font: -apple-system-body) { @media (pointer: coarse) { html { font: -apple-system-body; } } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--body); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
body.locked { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px; background: none; color: var(--muted); }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn svg circle { fill: currentColor; stroke: none; }
.text-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 0; background: none; padding: 0 6px; color: var(--muted); font-size: .9375rem; }
.text-btn svg { width: 20px; height: 20px; }
.text-btn.danger, .danger { color: var(--danger); }
.text-btn.armed { font-weight: 700; }
.keep { align-self: start; min-height: 48px; font-weight: 700; font-size: 1rem; line-height: 1; color: var(--on-press); background: var(--press); border: 0; border-radius: 999px; padding: 0 24px; }
.keep.sm { min-height: 40px; padding: 0 18px; font-size: .9375rem; }
.err { margin: 0; color: var(--danger); font-size: .875rem; }
.err:empty { display: none; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 8px; max-width: 680px; margin: 0 auto; }
.top.menu-open { z-index: 25; }
.scrim { position: fixed; inset: 0; background: rgb(15 20 35 / .45); }
.scrim[hidden] { display: none; }
.bar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font: 800 2rem/1 var(--display); letter-spacing: -.01em; }
.menu { position: absolute; right: 0; top: 46px; z-index: 10; display: grid; width: min(280px, calc(100vw - 32px)); padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px -20px rgb(15 20 35 / .45); }
.menu { gap: 0; max-height: calc(100dvh - 220px); overflow-y: auto; overscroll-behavior: contain; }
.menu button { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none; color: var(--ink); font-weight: 600; min-height: 44px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.menu button + button, .menu .menu-note + button { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.menu button::after { content: ""; flex: none; width: 8px; height: 8px; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); transform: rotate(45deg); margin-inline-end: 4px; }
.menu .mi { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.menu .ml { flex: 1; min-width: 0; line-height: 1.2; }
.menu .ml small { display: block; font-size: .8125rem; font-weight: 400; line-height: 1.2; margin-top: 2px; color: var(--muted); }
.menu button:hover { background: var(--bg); }
.menu button:active { background: var(--line); }
.menu-note { margin: 2px 12px 8px; font-size: .8125rem; line-height: 1.25; color: var(--muted); }
@media (forced-colors: active) { .menu button + button, .menu .menu-note + button { border-top-color: ButtonText; } .menu button::after { border-color: ButtonText; } }
.search { margin-top: 10px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.search:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.found { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; padding-left: 6px; font: .8125rem/1.3 var(--meta); color: var(--muted); }
.found-nav { display: flex; align-items: center; }

/* Notes above the timeline */
main { max-width: 680px; margin: 0 auto; position: relative; }
/* Notes: plain lines above the years, not cards. */
.notes { display: grid; gap: 6px; padding: 6px 16px 4px; }
.notes:empty { display: none; }
.note { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; font-size: .9375rem; line-height: 1.4; color: var(--muted); }
.note.warn { color: var(--ink); padding-left: 10px; border-left: 3px solid var(--fall); }
.note.meta { font: 500 .75rem/1.4 var(--meta); text-transform: uppercase; letter-spacing: .05em; }
.note.soft .note-text { font-style: italic; }
.note.ask { display: grid; gap: 4px; }
.note.ask .prompt { color: var(--ink); }
.ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.ask-row .jog-btn { margin: 2px 0; }
.note-text { flex: 0 1 auto; min-width: 0; }
.note-btn { min-height: 32px; border: 0; background: none; color: var(--ink); padding: 0 2px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.note-btn.primary { text-decoration-color: currentColor; }

/* Timeline */
.tl { position: relative; --label-x: 90px; }
.yr { position: absolute; left: 16px; margin: 0; font: 400 .75rem/1 var(--meta); color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.yr.major { font-weight: 700; color: var(--ink); }
.yr.before { font-style: italic; }
.yr small { display: block; margin-top: 3px; font-size: .6875rem; font-weight: 500; color: var(--muted); font-style: normal; }
.yr.now { color: var(--ink); opacity: 1; font-weight: 700; }
.band { position: absolute; width: 11px; border-radius: 6px; background: linear-gradient(to bottom, transparent 0%, var(--c1) var(--f), var(--c2) calc(100% - var(--f)), transparent 100%); filter: blur(3px); opacity: .75; }
.core { position: absolute; width: 5px; border-radius: 3px; background: linear-gradient(var(--c1), var(--c2)); }
.leaders { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.leaders path { fill: none; stroke: var(--c1); stroke-width: 1; opacity: .55; }
.leaders circle { fill: var(--c1); stroke: none; }
.mem-item { position: absolute; left: var(--label-x); right: 16px; }
.has-scrub .mem-item, .has-scrub .gap-item { right: 42px; }
.has-scrub .notes { padding-right: 42px; }
.mem { display: grid; gap: 2px; width: 100%; text-align: start; background: none; border: 0; padding: 0; border-radius: 8px; }
.mem .t { font-size: 1rem; line-height: 1.32; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.mem .who, .rd-text .who { color: var(--c1-ink, var(--summer-ink)); font-weight: 600; }
.mem .m { font: 500 .75rem/1.3 var(--meta); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.mem .m b { font-weight: 600; color: var(--c1-ink); }
.thumb-wrap { position: relative; display: inline-block; margin-top: 6px; justify-self: start; }
.thumb-wrap img { display: block; width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--line); }
.thumb-wrap .more { position: absolute; right: 4px; bottom: 4px; font: 700 .75rem/1 var(--meta); background: var(--press); color: var(--on-press); border-radius: 999px; padding: 4px 7px; }
.mem.open { outline: 2px solid var(--faint); outline-offset: 4px; }
.mem.cur { outline: 2px solid var(--ink); outline-offset: 4px; }
.dimmed .band:not(.hit), .dimmed .core:not(.hit), .dimmed .mem-item:not(.hit), .dimmed .leaders g:not(.hit) { opacity: .22; }
.dimmed .gap-item { opacity: .4; }
.fresh { animation: settle 1.2s ease-out; }
.firming { animation: firm 1.4s ease-out; }
@keyframes settle { from { filter: blur(14px); opacity: .2; } }
@keyframes firm { from { filter: blur(16px); transform: scaleY(1.5); opacity: .5; } }

/* Gaps: a faint hatch in the gutter and a quiet question at the top. */
.gap-item { position: absolute; left: 52px; right: 16px; }
.gap-item::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: calc(var(--label-x) - 66px); border-radius: 6px; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px); opacity: .9; }
.gap { position: absolute; left: calc(var(--label-x) - 52px); right: 0; top: 0; display: grid; align-content: start; gap: 2px; text-align: start; padding: 2px 0 8px; border: 0; background: none; color: var(--muted); border-radius: 8px; }
.gap-a { font: 500 .75rem/1.3 var(--meta); text-transform: uppercase; letter-spacing: .05em; }
.gap-b { font: 600 1rem/1.3 var(--display); color: var(--ink); }
.gap-b[hidden] { display: none; }
.gap.asked { z-index: 2; background: var(--bg); box-shadow: 0 0 0 6px var(--bg); }
.gap:hover .gap-b { text-decoration: underline; text-underline-offset: 3px; }

.scrub { position: fixed; z-index: 4; right: max(0px, calc(50vw - 340px)); top: 150px; bottom: calc(96px + var(--sab)); width: 30px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: ns-resize; }
.scrub-tick { position: absolute; right: 4px; font: 500 .6875rem/1 var(--meta); color: var(--muted); transform: translateY(-50%); }
.scrub-mark { position: absolute; left: 2px; width: 6px; height: 2px; border-radius: 1px; transform: translateY(-50%); opacity: .9; }
.scrub-bubble { position: absolute; right: 40px; transform: translateY(-50%); font: 800 2.25rem/1 var(--display); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 16px; opacity: 0; pointer-events: none; transition: opacity .15s; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scrub-bubble small { display: block; font: 500 .75rem/1.2 var(--meta); color: var(--muted); margin-top: 4px; }
.scrub-bubble.on { opacity: 1; }

.fab { position: fixed; z-index: 6; right: max(16px, calc(50vw - 340px + 16px)); bottom: calc(18px + var(--sab)); width: 58px; height: 58px; border-radius: 999px; border: 0; display: grid; place-items: center; background: var(--press); color: var(--on-press); box-shadow: 0 12px 28px -12px rgb(15 20 35 / .6); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* Sheets (dialogs) */
.sheet { position: fixed; inset: 0; z-index: 20; background: var(--surface); overflow: hidden; }
.sheet:focus, .sheet h2:focus { outline: none; }

/* Editor */
.ed-col { position: relative; height: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top, 0px) + 8px) 0 calc(10px + var(--sab)); }
.ed-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; }
.ed-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px calc(66px + (1rem - 16px) * 3) 16px 20px; }
.mode { display: flex; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid var(--line); }
.mode button { min-height: 40px; font: 600 .875rem/1 var(--meta); color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 0 12px; }
.mode button[aria-pressed="true"] { background: var(--press); color: var(--on-press); }
.when { display: grid; gap: 2px; }
/* The date stays in view while a long memory scrolls underneath it. */
.ed-body .when { position: sticky; top: -10px; z-index: 2; background: var(--surface); padding-top: 8px; margin-top: -8px; }
.when-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.steppers { display: flex; flex-direction: column; margin-top: 4px; }
.when-btn { display: block; text-align: left; border: 0; background: none; padding: 0; font: 800 3rem/.98 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.when-btn .s { display: block; font-weight: 600; font-size: 1.75rem; color: var(--season-ink, var(--muted)); }
.ends { display: grid; gap: 0; }
.year-input { width: 5.2ch; font: 800 2.75rem/1 var(--display); color: var(--ink); background: var(--bg); border: 2px solid var(--season-ink, var(--ink)); border-radius: 12px; padding: 4px 8px; }
.ends .year-input { font-size: 1.75rem; }
.end { display: grid; grid-template-columns: 2.6em 1fr; align-items: baseline; text-align: left; min-height: 44px; font: 800 1.625rem/1.12 var(--display); letter-spacing: -.02em; color: var(--muted); background: none; border: 0; padding: 2px 0; }
.end .k { font: 600 .6875rem/1 var(--meta); letter-spacing: .06em; text-transform: uppercase; }
.end[aria-pressed="true"] { color: var(--ink); }
.end[aria-pressed="true"] .k { color: var(--season-ink); }
.ago { margin: 0; font-size: .875rem; color: var(--muted); }
textarea { flex: none; min-height: 7.5rem; overflow: hidden; resize: none; border: 0; border-inline-start: 2px solid var(--line); background: none; font: 1.25rem/1.4 var(--body); padding: 2px 0 2px 12px; padding-inline: 12px 0; outline: none; }
textarea:focus { border-inline-start-color: var(--season-ink); }
textarea:focus-visible { outline: none; }
textarea::placeholder { color: var(--muted); }
.people { display: flex; gap: 6px; overflow-x: auto; margin-top: -6px; padding: 2px; scrollbar-width: none; }
.people button { flex: none; min-height: 40px; font-size: .875rem; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; border-radius: 999px; }
.people button.cur { border-color: var(--ink); background: var(--press); color: var(--on-press); }
.people .hint { font: .875rem/1.3 var(--meta); color: var(--muted); padding: 10px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 2px; }
.chips button { min-height: 44px; font-size: .9375rem; line-height: 1; color: var(--muted); background: none; border: 0; padding: 0 11px; border-radius: 999px; }
.chips button[aria-pressed="true"] { background: var(--season-ink, var(--press)); color: var(--on-press); }
.chips button:disabled { opacity: .35; }
.months { margin-top: -8px; min-height: 44px; }
.months:empty { display: none; }
.months button { font: 500 .875rem/1 var(--meta); padding: 0 10px; }
.months button[aria-pressed="true"] { background: none; color: var(--season-ink); box-shadow: inset 0 0 0 2px var(--season-ink); }
.months .hint { font: .8125rem/1 var(--meta); color: var(--muted); align-self: center; padding: 0 4px; }
.slack-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.slack-label { font-size: .875rem; color: var(--muted); margin-right: 4px; }
.slack { min-height: 40px; font: 500 .8125rem/1 var(--meta); background: none; border: 1px dashed var(--muted); border-radius: 999px; padding: 0 14px; }
.jog { display: grid; gap: 0; justify-items: start; margin-bottom: -6px; }
.jog-btn { color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px 0 12px; min-height: 40px; margin: 2px 0 4px; }
.jog-btn:hover { border-color: var(--season-ink, var(--muted)); }
.prompt { margin: 0; padding: 2px 0 2px 12px; padding-inline: 12px 0; border-left: 2px solid var(--season-ink, var(--line)); font: 600 1.25rem/1.3 var(--display); }
.photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.thumbs { list-style: none; margin: 0; padding: 6px 0 0; display: flex; flex-wrap: wrap; gap: 14px; }
.thumb-item { position: relative; }
.thumb-item img { display: block; width: 84px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--line); }
#deleteBtn { align-self: start; margin-top: 8px; }
.photo-x { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 999px; border: 0; display: grid; place-items: center; background: var(--press); color: var(--on-press); }
.photo-x::after { content: ""; position: absolute; inset: -8px; }
.photo-x svg { width: 14px; height: 14px; stroke-width: 2.6; }

.rail { position: absolute; right: 8px; top: 64px; bottom: calc(26px + var(--sab)); width: 46px; touch-action: none; cursor: ns-resize; border-radius: 23px; user-select: none; -webkit-user-select: none; }
.rail.pulse { animation: pulse .9s ease-out; }
@keyframes pulse { 0% { background: color-mix(in srgb, var(--season) 0%, transparent); } 30% { background: color-mix(in srgb, var(--season) 22%, transparent); } 100% { background: transparent; } }
.tick { position: absolute; right: 8px; width: 5px; height: 1px; background: var(--muted); opacity: .6; }
.tick.major { width: 9px; background: var(--ink); opacity: .8; }
.tick span { position: absolute; right: 13px; top: -6px; font: 500 .6875rem/1 var(--meta); color: var(--muted); }
.rail .before { position: absolute; right: 4px; width: 22px; border-radius: 11px; background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px); }
.rail-label { position: absolute; right: 30px; transform: translateY(-50%); font: 700 .6875rem/1 var(--meta); text-transform: uppercase; letter-spacing: .05em; color: var(--ink); background: var(--surface); padding: 1px 2px; }
.halo { position: absolute; right: 9px; width: 14px; border-radius: 7px; background: var(--season); opacity: .22; }
.halo::before, .halo::after { content: ""; position: absolute; left: -3px; right: -3px; height: 2px; border-radius: 1px; background: var(--season); }
.halo::before { top: 0; } .halo::after { bottom: 0; }
.span { position: absolute; right: 13px; width: 6px; border-radius: 3px; background: var(--season); opacity: .5; }
.thumb { position: absolute; right: 2px; width: 26px; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--season-ink, var(--ink)); }
.thumb.idle { opacity: .35; }
.bubble { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); font: 800 5.25rem/1 var(--display); letter-spacing: -.03em; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 18px 26px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bubble.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.bubble small { display: block; font: 500 .875rem/1.2 var(--meta); color: var(--muted); text-align: center; letter-spacing: 0; margin-top: 6px; }

/* Reader */
.reader, .people-dlg, .person-dlg, .restore-dlg { overflow-y: auto; }
.rs-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: 1rem; }
.rs-birth { display: flex; gap: 10px; align-items: flex-start; font-size: .9375rem; color: var(--muted); }
.rs-birth input { width: 22px; height: 22px; margin-top: 1px; flex: none; }
.rs-acts { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; }
.rd-col { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 8px) 20px calc(32px + var(--sab)); display: grid; gap: 14px; }
.rd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -8px; }
.rd-top h2 { margin: 0 8px; font: 800 1.5rem/1 var(--display); }
.rd-when { margin: 8px 0 0; font: 800 2.625rem/1 var(--display); letter-spacing: -.02em; text-wrap: balance; }
.rd-meta { margin: -8px 0 0; color: var(--muted); font-size: .9375rem; }
.rd-acts { display: flex; align-items: center; gap: 6px; }
.rd-photos { list-style: none; margin: 0 -20px; padding: 0 20px 6px; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 20px; }
.rd-photos li { flex: none; scroll-snap-align: start; }
.rd-photo { padding: 0; border: 0; background: none; border-radius: 14px; overflow: hidden; display: block; }
.rd-photo img { display: block; height: min(42vh, 320px); width: auto; max-width: 82vw; object-fit: cover; border-radius: 14px; background: var(--line); }
.rd-photos li:only-child .rd-photo img { max-width: 100%; height: auto; max-height: 50vh; }
.rd-near h3 { margin: 10px 0 6px; font: 700 .8125rem/1 var(--meta); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rd-near ul, .ps-list { list-style: none; margin: 0; padding: 0; display: grid; }
.near-btn { display: grid; gap: 2px; width: 100%; text-align: start; border: 0; border-top: 1px solid var(--line); background: none; padding: 12px 0; }
.near-when { font: 600 .75rem/1.2 var(--meta); text-transform: uppercase; letter-spacing: .05em; color: var(--c1-ink, var(--muted)); }
.near-text { font-size: 1rem; line-height: 1.35; }
.near-text .who { font-weight: 600; color: var(--c1-ink, var(--ink)); }
.rd-text { font-size: 1.25rem; line-height: 1.5; }
.rd-text p { margin: 0 0 .7em; white-space: pre-line; }
.rd-text mark { background: color-mix(in srgb, var(--season-ink, var(--summer)) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.rd-step { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.rd-step .near-btn { border-top: 2px solid var(--line); min-height: 44px; }
.rd-step .near-btn[hidden] { display: none; }
.rd-step #rdNext { text-align: right; }
.rd-people { display: flex; flex-wrap: wrap; gap: 8px; }
.person-btn { min-height: 40px; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 0 14px; font-size: .875rem; }
.viewer { background: #000; display: grid; place-items: center; }
.viewer img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.view-x, .view-prev, .view-next { position: absolute; color: #fff; background: rgb(0 0 0 / .55); }
.view-x { top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; }
.view-prev, .view-next { top: 50%; transform: translateY(-50%); }
.view-prev { left: 8px; } .view-next { right: 8px; }
.view-count { position: absolute; bottom: calc(14px + var(--sab)); left: 0; right: 0; margin: 0; text-align: center; color: #fff; font: 600 .875rem/1 var(--meta); }
.viewer :focus-visible { outline-color: #fff; }

/* People */
.pd-note { margin: 0; color: var(--muted); font-size: .875rem; }
.pd-list { list-style: none; margin: 0; padding: 0; display: grid; }
.pd-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.pd-name { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; min-height: 52px; text-align: left; border: 0; background: none; padding: 0; font-size: 1.0625rem; font-weight: 600; }
.pd-name small { font: .75rem/1 var(--meta); color: var(--muted); font-weight: 400; }
.pd-rename { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 0; }
.pd-rename .at { font-weight: 600; }
.pd-rename input { flex: 1 1 8rem; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0 10px; }
.pd-rename .err { flex-basis: 100%; }
.pd-empty { color: var(--muted); padding: 12px 0; }

/* Welcome */
.welcome { display: grid; place-items: center; padding: 24px 16px calc(24px + var(--sab)); overflow-y: auto; }
.welcome-col { max-width: 30rem; display: grid; gap: 14px; }
.welcome h2 { margin: 0; font: 800 3rem/1 var(--display); letter-spacing: -.03em; }
.welcome p { margin: 0; color: var(--muted); }
.welcome form { display: grid; gap: 10px; margin-top: 18px; }
.welcome label { font: 700 1.25rem/1.2 var(--display); }
.birth-row { display: flex; gap: 10px; }
.birth-row { align-items: center; }
.birth-row input { width: 5.4ch; font: 800 3rem/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; }
.birth-row input:focus-visible { border-color: var(--ink); }
.drag-hint { font-size: .875rem; }
.hemi-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; font-size: .9375rem; color: var(--muted); margin-top: -4px; }
.hemi-row .text-btn { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
/* The strip beside it is a pointer-only extra: it fills the box in as you drag. */
.birth-strip { position: absolute; right: 8px; top: calc(env(safe-area-inset-top, 0px) + 40px); bottom: calc(40px + var(--sab)); width: 46px; touch-action: none; cursor: ns-resize; user-select: none; -webkit-user-select: none; border-radius: 23px; }
.welcome { padding-right: 70px; }
.fine { font-size: .875rem; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(92px + var(--sab)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; background: var(--press); color: var(--on-press); padding: 8px 8px 8px 16px; border-radius: 18px; font-size: .875rem; line-height: 1.35; width: max-content; max-width: calc(100vw - 32px); }
.toast button:focus-visible { outline-color: var(--on-press); }
.toast button { min-height: 36px; border: 0; border-radius: 999px; padding: 0 14px; background: var(--on-press); color: var(--press); font-weight: 700; }


/* Windows high contrast: keep the shapes and the pressed state. */
@media (forced-colors: active) {
  .fab, .keep, .toast button, .end:not([aria-pressed="true"]) { border: 1px solid ButtonText; }
  .band, .core, .thumb, .halo, .span, .scrub-mark, .rail .before { forced-color-adjust: none; }
  [aria-pressed="true"], .mem.cur { outline: 2px solid Highlight; outline-offset: 2px; }
  textarea:focus-visible { outline: 2px solid Highlight; }
  .note.warn { border-left-color: CanvasText; }
}

@media (prefers-reduced-motion: reduce) {
  .fresh, .firming, .rail.pulse { animation: none; }
  .bubble, .scrub-bubble { transition: none; }
}

/* Each paragraph takes the direction of its own text (Arabic, Hebrew, …). */
.mem .t, .note-text, .rd-text p, .ps-line, .gap-b, .snip { unicode-bidi: plaintext; }

/* A tag keeps its @ on the side it was typed, even inside right-to-left text. */
.who { unicode-bidi: isolate; }
/* Long unbroken text (a web address, a run of letters) wraps instead of leaving the screen. */
.rd-col > * { min-width: 0; }
.rd-text, .rd-text p, .near-text, .rd-meta, .rd-when { overflow-wrap: anywhere; }

#moreBtn { color: var(--ink); }

@media (pointer: coarse) {
  .note-btn, .gap { min-height: 44px; }
}

/* While the diary is empty the + says what it is. */
.fab-label { display: none; font: 700 1rem/1 var(--display); }
.empty-diary .fab { width: auto; padding-inline: 16px 22px; grid-auto-flow: column; gap: 8px; }
.empty-diary .fab-label { display: block; }
.drag-hint { margin-top: -4px; }
.end { border-radius: 10px; padding-inline: 10px 8px; box-shadow: inset 0 0 0 1px transparent; }
.end:not([aria-pressed="true"]) { box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 340px) { .end { font-size: 1.375rem; } .ask-row .jog-btn { padding: 0 12px 0 10px; } .ask-row { gap: 0 2px; } }

/* One layer holds the bands; another measures labels out of sight. */
.layer { position: absolute; left: 0; top: 0; right: 0; height: 0; pointer-events: none; }
.measure { position: absolute; left: 0; top: 0; right: 0; height: 0; visibility: hidden; pointer-events: none; }

/* A long diary: soften the bands' edges without a blur filter on thousands of elements. */
.layer { isolation: isolate; }
.long-diary .band { filter: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%, #000 65%, transparent); mask-image: linear-gradient(90deg, transparent, #000 35%, #000 65%, transparent); }
/* A photo that can't be found keeps its place, so nothing shifts. */
.thumb-wrap.gone { background: var(--line); border-radius: 8px; }
.thumb-wrap.gone img { visibility: hidden; }

.photo-hint { margin: 0; font-size: .9375rem; color: var(--muted); }
.photo-hint .text-btn { min-height: 36px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.private-row { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); font-size: .9375rem; }
.private-row input { width: 20px; height: 20px; accent-color: var(--season-ink, var(--ink)); }
.private-fine { margin: -8px 0 0; }
.ps-actions { margin: -4px 0 8px; display: flex; flex-wrap: wrap; gap: 0 12px; }
.photo-hint .text-btn { min-height: 44px; min-width: 44px; white-space: nowrap; }
.photo-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.photo-hint span { flex: 1 1 100%; }

/* Tablet: the timeline on the left, the reader or editor in a pane on the right. */
.pane-empty { display: none; }
@media (min-width: 744px) {
  :root { --list-w: clamp(340px, 42vw, 460px); }
  .top, main { max-width: var(--list-w); margin: 0; }
  .scrub { right: auto; left: calc(var(--list-w) - 30px); }
  .fab { right: auto; left: calc(var(--list-w) - 74px); }
  .sheet.editor, .sheet.reader { inset: 0 0 0 var(--list-w); border-left: 1px solid var(--line); }
  .pane-empty { position: fixed; inset: 0 0 0 var(--list-w); z-index: 1; display: grid; place-content: center; gap: 4px; padding: 24px; text-align: center; background: var(--surface); border-left: 1px solid var(--line); color: var(--muted); font: 600 1.0625rem/1.3 var(--display); }
  .pane-empty p { margin: 0; }
  body.pane-open .pane-empty { display: none; }
  .top[inert] > *, main[inert], #addBtn[inert], #scrub[inert] { opacity: .45; }
  .rd-step { grid-template-columns: 1fr; gap: 0; }
  .rd-step #rdNext { text-align: start; }
  .empty-diary .pane-empty .open-line { display: none; }
}
