/* Still Here: warm paper, ink, and one heartbeat line. */
:root {
  --bg: #f6f1e8;
  --bg-2: #efe7da;
  --card: #fffdf8;
  --ink: #1d1914;
  --ink-2: #4a4239;
  --muted: #7a6f62;
  --line: #e4dacb;
  --line-2: #d6c9b6;
  --beat: #e0533a;
  --beat-soft: #f7d9cf;
  --ok: #2f7a55;
  --ok-soft: #dcefe3;
  --wait: #b9821c;
  --wait-soft: #f6ead0;
  --quiet: #c2412d;
  --quiet-soft: #f8ddd6;
  --pause: #6b6aa8;
  --pause-soft: #e4e3f3;
  --focus: #1f6feb;
  --shadow: 0 1px 0 rgba(60, 40, 20, .04), 0 8px 24px -12px rgba(60, 40, 20, .18);
  --radius: 18px;
  --serif: "Fraunces", ui-serif, Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --bg-2: #1d1914;
    --card: #211c17;
    --ink: #f3ece1;
    --ink-2: #d4c9ba;
    --muted: #a3978a;
    --line: #342d25;
    --line-2: #463d33;
    --beat: #ff7a5c;
    --beat-soft: #4a2a22;
    --ok: #6cc99a;
    --ok-soft: #1f3a2c;
    --wait: #e7b65a;
    --wait-soft: #3d3120;
    --quiet: #ff8a73;
    --quiet-soft: #45241d;
    --pause: #a9a8e6;
    --pause-soft: #2c2b45;
    --focus: #79b0ff;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-variation-settings: "opsz" 144; }
h1 em, h2 em { font-style: italic; color: var(--beat); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.15rem; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
code { font: 500 .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-2); padding: .1em .4em; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--card); padding: 8px 12px; border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 1.15rem var(--serif); letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 20px; fill: none; stroke: var(--beat); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: .925rem; }
.topnav a { text-decoration: none; color: var(--ink-2); }
.topnav a:hover { color: var(--ink); }
.viewer { color: var(--muted); }

/* ---------- buttons, tags, dots ---------- */
.btn { --b: var(--line-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border-radius: 999px; border: 1px solid var(--b); background: var(--card); color: var(--ink);
  font: 500 .95rem var(--sans); text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: color-mix(in oklab, var(--ink) 86%, var(--beat)); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.topnav .btn-sm { color: var(--ink); }
.btn[disabled], .chip[disabled], .link-btn[disabled], .x[disabled] { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); font: 500 .85rem var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover:not([disabled]) { color: var(--quiet); }

.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font: 500 .75rem var(--sans);
  background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-demo { background: var(--wait-soft); color: var(--wait); }

.dot { --c: var(--muted); display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 8px;
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--c) 50%, transparent); flex: none; }
.dot-ok { --c: var(--ok); animation: ping 2.4s ease-out infinite; }
.dot-waiting, .dot-new { --c: var(--wait); }
.dot-quiet { --c: var(--quiet); animation: ping 1.6s ease-out infinite; }
.dot-paused { --c: var(--pause); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--c) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }

.eyebrow { display: flex; align-items: center; font: 500 .8rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card > h2 { margin-bottom: 6px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head > span { font-size: .85rem; }
.card-head form { margin: 0; }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; padding-top: 56px; padding-bottom: 72px; }
.lede { font-size: 1.125rem; color: var(--ink-2); margin-top: 20px; max-width: 34rem; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero-foot { margin-top: 18px; font-size: .85rem; }
.hero-art { position: relative; display: grid; gap: 18px; }
.phone { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 14px; box-shadow: var(--shadow); max-width: 400px; justify-self: end; width: 100%; }
.phone-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); }
.phone-head b { display: block; font-size: .95rem; }
.phone-head small { color: var(--muted); font-size: .75rem; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--beat-soft); color: var(--beat);
  font: 600 .8rem var(--sans); flex: none; text-transform: uppercase; }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 14px 4px 4px; }
.bubble { max-width: 82%; padding: 9px 13px 18px; border-radius: 16px; font-size: .925rem; position: relative; line-height: 1.4;
  opacity: 0; animation: rise .5s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--d) * .55s + .2s); }
.bubble time { position: absolute; right: 10px; bottom: 4px; font-size: .68rem; color: var(--muted); }
.bubble.bot { background: var(--bg-2); border-bottom-left-radius: 5px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 5px; }
.bubble.me time { color: color-mix(in oklab, var(--bg) 65%, transparent); }
.sys { margin-top: 6px; font-size: .8rem; color: var(--ink-2); background: var(--ok-soft); border-radius: 12px; padding: 9px 12px;
  opacity: 0; animation: rise .5s ease forwards; animation-delay: calc(var(--d) * .55s + .3s); }
.sys b { color: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-pulse { padding: 16px 18px 12px; margin-right: 56px; margin-top: -48px; position: relative; }
.hero-pulse .card-head { margin-bottom: 4px; font-size: .85rem; color: var(--ink-2); }
.hero-pulse .pulse-legend { display: none; }

.section { padding-top: 56px; padding-bottom: 56px; }
.section-head { max-width: 46rem; margin-bottom: 32px; }
.section-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.section-head p.muted { margin-top: 14px; font-size: 1.05rem; }
.beats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; position: relative; }
.beats::before { content: ""; position: absolute; left: 0; right: 0; top: 15px; height: 2px; background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, transparent 6px 12px); }
.beats li { position: relative; padding-top: 44px; }
.beats li::before { content: ""; position: absolute; top: 9px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--beat); }
.beats .beat-alert::before { border-color: var(--quiet); background: var(--quiet); }
.beat-time { font: 500 .8rem ui-monospace, Menlo, monospace; color: var(--beat); }
.beats h3 { margin: 4px 0 8px; }
.beats p { color: var(--ink-2); font-size: .95rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.split-card { padding: 30px; }
.split-card h3 { font-size: 1.6rem; margin-bottom: 18px; }
.split-private { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.split-private .eyebrow { color: color-mix(in oklab, var(--bg) 60%, transparent); }
.split-private code { background: color-mix(in oklab, var(--bg) 14%, transparent); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 28px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 12px; height: 7px; border-left: 2px solid var(--beat); border-bottom: 2px solid var(--beat); transform: rotate(-45deg) translateY(-3px); }
.open-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.open-grid > div { border-top: 2px solid var(--ink); padding-top: 18px; }
.open-grid h3 { margin-bottom: 10px; }
.open-grid p { color: var(--ink-2); font-size: .95rem; }

/* ---------- pulse ---------- */
.pulse { position: relative; margin: 0; color: var(--beat); }
.pulse-plot { position: relative; }
.pulse-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.pulse-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 4; }
.pulse-paused { fill: var(--pause-soft); opacity: .7; rx: 4px; }
.pulse-line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.2s cubic-bezier(.4, 0, .2, 1) .15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pulse-points { position: absolute; inset: 0; pointer-events: none; }
.pt { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 0; padding: 0; background: transparent; cursor: pointer; pointer-events: auto; border-radius: 50%; }
.pt::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); border: 2px solid var(--beat); transition: transform .15s; }
.pt:hover::after, .pt:focus-visible::after, .pt.on::after { transform: scale(1.5); background: var(--beat); }
.pt-quiet::after { border-color: var(--quiet); background: var(--quiet-soft); border-style: dashed; }
.pt-waiting::after { border-color: var(--wait); }
.pt:last-child::after { background: var(--beat); box-shadow: 0 0 0 4px var(--beat-soft); }
.pulse-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 14px)); background: var(--ink); color: var(--bg); padding: 8px 12px;
  border-radius: 10px; font-size: .8rem; width: max-content; max-width: 240px; pointer-events: none; box-shadow: var(--shadow); line-height: 1.35; }
.pulse-tip b { display: block; font-weight: 600; }
.pulse-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: .78rem; color: var(--muted); }
.lg { display: inline-block; width: 18px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.lg-beat { fill: none; stroke: var(--beat); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.lg-quiet { border-top: 2px dashed var(--quiet); height: 2px; vertical-align: 3px; }
.lg-pause { background: var(--pause-soft); border-radius: 3px; }

/* ---------- dashboard ---------- */
.dash { padding-top: 28px; padding-bottom: 48px; display: grid; gap: 20px; }
.status { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end; padding: 30px; border-radius: 24px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.status::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--ok); }
.status-waiting::before, .status-new::before { background: var(--wait); }
.status-quiet { background: color-mix(in oklab, var(--quiet-soft) 55%, var(--card)); }
.status-quiet::before { background: var(--quiet); }
.status-paused::before { background: var(--pause); }
.status h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
.status-detail { margin-top: 12px; color: var(--ink-2); font-size: 1.05rem; max-width: 40rem; }
.stats { display: flex; gap: 28px; margin: 0; }
.stats div { min-width: 70px; }
.stats dt { font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 4px 0 0; font: 500 2rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.stats small { font: 400 .8rem var(--sans); color: var(--muted); margin-left: 3px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.side, .stack { display: grid; gap: 20px; }
.fineprint { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 8px; }

.days { list-style: none; margin: 0; padding: 0; }
.day { display: grid; grid-template-columns: 104px 1fr; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day-label { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-top { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.day-word { font: italic 500 1rem var(--serif); }
.day-line { color: var(--ink-2); font-size: .95rem; }
.day-meta { color: var(--muted); font-style: italic; }
.day-quiet .day-meta { color: var(--quiet); font-style: normal; }
.day-paused .day-meta { color: var(--pause); font-style: normal; }
.mood { display: inline-flex; gap: 3px; }
.mood i { width: 7px; height: 14px; border-radius: 3px; background: var(--line); }
.mood i.on { background: var(--beat); }
.mood-1 i.on, .mood-2 i.on { background: var(--wait); }
.mood-5 i.on { background: var(--ok); }

.note-form { display: grid; gap: 10px; margin-top: 14px; }
textarea, input, select { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; min-height: 88px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.people { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.people li { display: flex; align-items: center; gap: 10px; }
.people .avatar { width: 30px; height: 30px; background: var(--bg-2); color: var(--ink-2); }
.push { margin-left: auto; }
.hb { display: flex; align-items: center; margin: 10px 0 6px; font-weight: 500; }
.hb-bad { color: var(--quiet); }

/* ---------- friend page ---------- */
.me-hero { padding: 24px 0 8px; }
.me-hero h1 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); }
.me-hero .lede { margin-top: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font: 500 .9rem var(--sans); cursor: pointer; }
.chip:hover:not([disabled]) { border-color: var(--pause); color: var(--pause); }
.chip-on { background: var(--pause); color: var(--card); border-color: var(--pause); }
.form { display: grid; gap: 14px; margin-top: 12px; }
.form label { display: grid; gap: 6px; font-size: .85rem; color: var(--ink-2); font-weight: 500; }
.form-grid { grid-template-columns: 1fr 1fr; }
.span2 { grid-column: span 2; }
.inline { display: flex; align-items: center; gap: 8px; }
.memories { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.memories li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px; font-size: .925rem; }
.memories form { margin: 0; }
.x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); font-size: 1.25rem; cursor: pointer; line-height: 1; }
.x:hover:not([disabled]) { background: var(--quiet-soft); color: var(--quiet); }

/* ---------- setup ---------- */
.invite { display: grid; gap: 6px; margin-top: 14px; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.copy { display: flex; gap: 8px; }
.copy input { font: .85rem ui-monospace, Menlo, monospace; }
.checks { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 12px; }
.checks li { display: flex; align-items: flex-start; gap: 4px; }
.checks .dot { margin-top: 7px; animation: none; }
.checks b { display: block; font-weight: 500; }
.checks small { color: var(--muted); font-size: .8rem; word-break: break-word; }

/* ---------- toast & footer ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 999px; font-size: .9rem; box-shadow: var(--shadow); animation: rise .3s ease, fade .4s ease 4s forwards; max-width: calc(100% - 32px); }
@keyframes fade { to { opacity: 0; visibility: hidden; } }
.foot { border-top: 1px solid var(--line); margin-top: 24px; }
.foot-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 28px; font-size: .85rem; color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 32px; }
  .phone { justify-self: start; }
  .hero-pulse { margin: -36px 0 0 24px; }
  .beats { grid-template-columns: 1fr 1fr; row-gap: 32px; }
  .beats::before { display: none; }
  .open-grid, .split { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .me-grid .side { order: -1; }
  .status { grid-template-columns: 1fr; align-items: start; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .topnav a:not(.btn) { display: none; }
  .topnav .viewer { display: none; }
  .beats { grid-template-columns: 1fr; }
  .status { padding: 24px 20px; }
  .stats { gap: 18px; }
  .stats dd { font-size: 1.6rem; }
  .card { padding: 18px; }
  .day { grid-template-columns: 1fr; gap: 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .hero-pulse { margin: -28px 0 0 12px; }
  .split-card { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
  .pulse-line { stroke-dashoffset: 0; }
  .bubble, .sys { opacity: 1; }
}
.hero-pulse .pt:not(:last-child) { display: none; }
