/* Heartwoven: one column like a book's page; each person's memories carry their own colored thread. */
:root {
  --bg: #fdf4f6;
  --surface: #ffffff;
  --ink: #2e1630;
  --muted: #6b4f6e;
  --line: #ecd7de;
  --plum: #5b2160;
  --rose: #c7365f;
  --rose-soft: #fbe3ea;
  --gold: #b8871f;
  --ok: #1f7a4d;
  --bad: #b3261e;
  --focus: #c7365f;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Atkinson Hyperlegible", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1020; --surface: #2a1830; --ink: #f8ecf2; --muted: #d2b8cc; --line: #48304f;
    --plum: #e2a6e6; --rose: #ff86a8; --rose-soft: #4a2235; --gold: #e8c46a; --ok: #6fd3a0; --bad: #ff8a80; --focus: #ff86a8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1.1rem; line-height: 1.55;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 42rem; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
main { display: flex; flex-direction: column; gap: 20px; outline: none; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; text-wrap: balance; color: var(--plum); }
h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 1.9rem; font-weight: 700; }
h3 { font-size: 1.45rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--plum); }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 16px; }

header.top { padding-block: 18px 0; display: flex; flex-direction: column; gap: 8px; }
.brand { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 1.6rem; color: var(--rose); text-decoration: none; align-self: flex-start; }
.ribbon { height: 10px; border-radius: 5px;
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,0.35) 6px 8px),
    repeating-linear-gradient(90deg, var(--rose) 0 24px, var(--gold) 24px 36px, var(--plum) 36px 60px); }
.account { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 0.95rem; color: var(--muted); }
.foot { color: var(--muted); font-size: 0.9rem; text-align: center; padding-top: 12px; }

button { font: inherit; cursor: pointer; }
.btn { min-height: 3rem; padding: 0.5rem 1.2rem; border-radius: 12px; border: 2px solid var(--plum); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--rose); border-color: var(--rose); color: #ffffff; }
.btn.small { min-height: 2.6rem; padding: 0.3rem 0.85rem; font-size: 0.95rem; }
.btn.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--plum); text-decoration: underline; font-weight: 700; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

nav.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tab { min-height: 2.9rem; padding: 0.4rem 1rem; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; }
.tab[aria-current="page"] { background: var(--plum); border-color: var(--plum); color: var(--bg); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, legend { font-weight: 700; }
.hint { font-size: 0.95rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="datetime-local"], textarea, select {
  font: inherit; font-size: max(16px, 1rem); padding: 0.55rem 0.8rem; min-height: 3rem; width: 100%;
  border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
}
input.code { font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; max-width: 14rem; }
textarea { min-height: 6rem; }
input[type="file"] { font: inherit; max-width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 8px; }
.choice { display: flex; gap: 10px; align-items: center; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); }
.choice:has(input:checked) { border-color: var(--rose); background: var(--rose-soft); }

.status { font-weight: 700; min-height: 1.6rem; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.notice { background: var(--rose-soft); border-radius: 14px; padding: 14px 16px; }

.stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.story-link { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.story-link strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--plum); }

.day { font-family: var(--font-display); font-size: 1.5rem; color: var(--plum); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.memory { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--thread, var(--rose)); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 0.95rem; color: var(--muted); }
.who { font-weight: 700; color: var(--ink); }
.meanwhile { font-family: var(--font-display); font-style: italic; font-size: 1.2rem; color: var(--rose); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--rose-soft); color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.media { width: 100%; max-width: 100%; border-radius: 10px; display: block; background: var(--line); }
audio.media { background: none; }
.caption { font-size: 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.out { opacity: 0.6; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }

.recorder { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 2px dashed var(--line); border-radius: 14px; }
.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.linkbox { font-family: ui-monospace, Menlo, monospace; font-size: 0.95rem; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.list li > span { min-width: 0; overflow-wrap: anywhere; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }

.book { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 30px rgba(60, 20, 70, 0.12); padding: 36px 28px; display: flex; flex-direction: column; gap: 28px; }
.cover { text-align: center; display: flex; flex-direction: column; gap: 12px; padding-block: 20px; }
.cover h2 { font-size: 2.7rem; }
.cover .ribbon { width: 60%; margin: 0 auto; }
.book h3 { font-size: 1.9rem; text-align: center; }
.page { display: flex; flex-direction: column; gap: 10px; }
.credit { font-family: var(--font-display); font-style: italic; color: var(--muted); font-size: 1.1rem; }

.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; }
@media (max-width: 30rem) { h1 { font-size: 2.1rem; } .book { padding: 24px 16px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
