/*
 * FamilyEmber app shell (lane UX0): design tokens and the shared pieces of
 * the senior wireframes (Documents/FamilyEmber_Senior_Wireframes/,
 * FamilyEmber_Scale_to_5000_Families.docx section 9).
 *
 * Rules every screen keeps: body text 20 px, never under 16 px; touch
 * targets at least 48 px (main buttons 64 px and more); WCAG 2.1 AA contrast
 * in light and dark (checked in tests/js/fe_app_shell.test.js); words, not
 * symbols; one accent colour for the main action.
 */
:root {
  color-scheme: light;
  --bg: #fbf7f2;          /* brand cream, also the icon and splash background */
  --card: #ffffff;
  --fill: #f3ede6;
  --ink: #2b1d14;
  --muted: #5e4d42;
  --line: #b9aa9c;
  --accent: #b34a14;      /* ember; white text on it */
  --accent-ink: #ffffff;
  --accent-soft: #f7e3d8;
  --focus: #1f5fbf;
  --ok: #1d6633;          /* "We heard you clearly" (UX2) */
  --overlay: rgba(20, 12, 8, .55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1b1410;
    --card: #261c16;
    --fill: #2f241d;
    --ink: #f3e9df;
    --muted: #cbbaab;
    --line: #6e5b4d;
    --accent: #f08a4b;
    --accent-ink: #1b1410;
    --accent-soft: #3a2a20;
    --focus: #8ab4ff;
    --ok: #86d99e;
    --overlay: rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 20px/1.5 var(--font);
}
body.sheet-open { overflow: hidden; }
.shell {
  max-width: 760px; margin: 0 auto;
  /* Room for the iPhone notch and home bar when opened from the icon. */
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

h1 { font: 700 30px/1.2 var(--serif); margin: 0; }
h2 { font: 700 24px/1.25 var(--serif); margin: 0; }
p, li { margin: 0; }
h1:focus { outline: none; }
.muted { color: var(--muted); }
.small { font-size: 17px; }
.strong { font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 20px; }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Header: the word mark and Talk to Us (wireframes, every screen). */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 24px; }
.brand {
  font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
  font-size: 18px; text-decoration: none; min-height: 48px; display: inline-flex; align-items: center;
}
.main { display: block; }

/* The standard navigation at the top of every page (MO1 2026-11-21, lib/topnav.js):
   Back, Home and the page's next step, kept in view while the page scrolls. */
.topnav {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  margin: -8px 0 20px; padding: max(8px, env(safe-area-inset-top)) 0 10px; border-bottom: 2px solid var(--line);
}
.topnav-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.topnav-btn { min-height: 48px; padding: 8px 16px; font-size: 18px; flex: 0 0 auto; }
.topnav-next { margin-left: auto; flex: 0 1 auto; min-width: 0; max-width: 100%; }
/* A phone: the next step fills the rest of the row, or its own row when its words are long. */
@media (max-width: 599px) { .topnav-next { flex: 1 1 auto; } }
.topnav-next-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav [hidden] { display: none; }
/* What a page scrolls to (a field, an error) is not hidden under the bar. */
html { scroll-padding-top: calc(var(--nav-h, 0px) + 8px); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 22px; border-radius: 999px;
  font: 700 20px/1.25 var(--font); text-decoration: none; text-align: center;
  cursor: pointer; border: 3px solid var(--ink); background: var(--card); color: var(--ink);
}
.btn-talk { min-height: 56px; font-size: 19px; padding: 10px 18px; margin-left: auto; max-width: 100%; }
.btn-big { display: flex; width: 100%; min-height: 72px; border-radius: var(--radius); font-size: 24px; font-weight: 800; padding: 18px 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--ink); }
.btn-row { display: flex; width: 100%; border-radius: var(--radius); justify-content: flex-start; text-align: left; }
.btn .plus { font-size: 1.2em; line-height: 1; }
.link-big { display: inline-flex; align-items: center; min-height: 48px; font-size: 20px; font-weight: 700; }

/* Boxes, notes, steps */
.box { border: 2px solid var(--line); border-radius: var(--radius); background: var(--fill); padding: 18px; }
.box > * + * { margin-top: 10px; }
.note { border-left: 6px solid var(--accent); background: var(--accent-soft); padding: 14px 16px; border-radius: 8px; }
/* MO1 V3: the speaker's check of their Moment */
.ix-memory h2 { margin: 0 0 6px; }
.ix-memory p { font-size: 1.1rem; line-height: 1.6; white-space: pre-wrap; }
.ix audio { width: 100%; min-height: 48px; }
.areas { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.install { display: flex; flex-direction: column; gap: 16px; }
.install[hidden] { display: none; }
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 14px; }
ol.steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; }
ol.steps li::before {
  content: counter(step); flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* Banners: offline, and the owner's test view (?ui=v2). */
.banner { margin: 0 0 12px; padding: 12px 16px; border-radius: 12px; font-size: 18px; font-weight: 700; }
.banner[hidden] { display: none; }
.banner-offline { background: var(--ink); color: var(--bg); }
.banner-test { background: var(--accent-soft); color: var(--ink); border: 2px dashed var(--accent); }

/* Sheets (Talk to Us, the install steps): a bottom sheet on a phone, a
   centred dialog on a computer. */
.sheet-overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 10;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.sheet {
  width: 100%; max-width: 640px; max-height: 90vh; overflow: auto;
  background: var(--card); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px;
  padding: 22px; display: flex; flex-direction: column; gap: 16px;
}
.sheet:focus { outline: none; }
.sheet .btn { width: 100%; }

@media (min-width: 700px) {
  .shell { padding-top: max(28px, env(safe-area-inset-top)); }
  h1 { font-size: 36px; }
  .sheet-overlay { align-items: center; }
  .areas { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: filter .15s; }
  .btn:hover { filter: brightness(1.06); }
}

/* Sign-in (lane UX1, wireframes s02-s04). */
.stack.tight { gap: 8px; }
.block { display: block; }
.label { font-weight: 700; }
.lead { font-size: 22px; }
.field {
  width: 100%; min-height: 60px; padding: 12px 16px; border-radius: 14px;
  border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  font: 22px/1.3 var(--font);
}
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; border-top: 2px solid var(--line); }
.check-row { display: flex; gap: 14px; align-items: flex-start; }
.check { flex: none; width: 36px; height: 36px; margin: 4px 0 0; accent-color: var(--ink); }
.check-row label { min-height: 48px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
.linklike {
  background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer; min-height: 48px;
}
.code-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-width: 480px; }
.code-box {
  width: 100%; min-height: 72px; text-align: center; border-radius: 12px;
  border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  font: 800 34px/1 var(--font); padding: 0;
}
.account { display: flex; flex-direction: column; gap: 8px; border-top: 2px solid var(--line); padding-top: 16px; margin-top: 8px; }
.account .btn { align-self: flex-start; }

/* Contributor simple mode (lane UX2, wireframes s07-s10). */
.ix .question { font: 700 30px/1.25 var(--serif); }
.ix .lead { font-size: 22px; }
.ix .center { text-align: center; }
.ix .ok { color: var(--ok); }
.btn-mid { min-height: 64px; font-size: 21px; font-weight: 800; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px 0; }
.mic {
  width: 184px; height: 184px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: 800 24px/1.2 var(--font);
  display: flex; align-items: center; justify-content: center; padding: 18px; text-align: center;
  box-shadow: 0 0 0 14px var(--accent-soft);
}
.mic:disabled { opacity: .55; cursor: default; }
.mic-wrap.on .mic { box-shadow: 0 0 0 16px var(--accent-soft), 0 0 0 32px var(--fill); }
.wave { display: flex; gap: 7px; align-items: center; justify-content: center; height: 48px; }
.wave b { display: block; width: 11px; height: 18px; border-radius: 6px; background: var(--accent); }
.wave .w2, .wave .w6 { height: 32px; } .wave .w3, .wave .w5 { height: 44px; } .wave .w4 { height: 26px; }
@media (prefers-reduced-motion: no-preference) {
  .wave b { animation: ix-wave 1.1s ease-in-out infinite; }
  .wave .w2 { animation-delay: .15s; } .wave .w3 { animation-delay: .3s; } .wave .w4 { animation-delay: .45s; }
  .wave .w5 { animation-delay: .6s; } .wave .w6 { animation-delay: .75s; } .wave .w7 { animation-delay: .9s; }
}
@keyframes ix-wave { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
.pill-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill-row.one { grid-template-columns: 1fr; }
.btn-pill { min-height: 64px; border-radius: 999px; font-weight: 700; padding: 12px 16px; }
.btn-wide { width: 100%; }
.more { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.thanks { background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 14px 16px; font-weight: 700; }
.support { display: flex; flex-direction: column; gap: 8px; }
.offline-line { align-self: flex-start; background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 18px; font-weight: 700; }
.progress { height: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
.typed { min-height: 160px; resize: vertical; }
.consent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.consent-head { display: flex; align-items: center; gap: 14px; font-size: 22px; }
.tick {
  flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--ink); position: relative;
}
.tick::after {
  content: ""; position: absolute; left: 12px; top: 5px; width: 9px; height: 18px;
  border: solid var(--bg); border-width: 0 4px 4px 0; transform: rotate(45deg);
}
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: var(--bg);
  padding: 14px 20px; border-radius: 14px; font-weight: 700; z-index: 20; margin: 0;
}
.photo-box { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 700px) {
  .ix .question { font-size: 36px; }
  .mic { width: 200px; height: 200px; }
}
/* #184's photo box (interview-media.js, box mode) inside the app's sheet:
   the sheet has the title and Close, so the box's own heading row hides. */
.photo-box .pic-head { display: none; }
.photo-box .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;
}
.photo-box .hint { color: var(--muted); }
.photo-box .pic-add-box { display: flex; flex-direction: column; gap: 10px; }
.photo-box .pic-big { width: 100%; min-height: 64px; }
.photo-box .pic-sub { font: 700 22px/1.25 var(--serif); margin: 8px 0 0; }
.photo-box .pic-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.photo-box .pic-tile { display: flex; flex-direction: column; gap: 6px; }
.photo-box .pic-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--fill); }
.photo-box .pic-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-box .pic-tile-meta { display: flex; flex-direction: column; gap: 2px; }
.photo-box .pic-tile-name, .photo-box .pic-state { font-size: 17px; overflow-wrap: anywhere; }
.photo-box .pic-state { font-weight: 700; }
.photo-box .alert { border-left: 6px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 8px; }
.photo-box .pic-confirm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-box .pic-progress { display: flex; flex-direction: column; gap: 8px; }
.photo-box .pic-progress progress { width: 100%; height: 16px; }
.photo-box .link { font: 700 18px/1.3 var(--font); min-height: 48px; background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; }

/* Owner's tools in plain words (lane UX5, wireframes s17 and s21). */
html[data-text-size="bigger"] body { zoom: 1.15; }
html[data-text-size="biggest"] body { zoom: 1.3; }
.owner-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.bar-btn { min-height: 56px; padding: 10px 18px; border-radius: 16px; font-size: 20px; }
.bar-btn[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.owner .h-check { font-size: 30px; }
.owner .h-check strong { font-weight: 700; }
.sentence { background: var(--fill); }
.sentence p { font-size: 22px; }
.sentence .muted { font-size: 20px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: 18px; }
.details dt { font-weight: 700; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.btn[aria-checked="true"], .btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.more-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.alert-box { border-color: var(--accent); background: var(--accent-soft); }
.radio-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 8px 4px;
  background: none; border: 0; color: var(--ink); font: 400 21px/1.3 var(--font); text-align: left; cursor: pointer;
}
.radio-row:disabled { opacity: .6; cursor: default; }
.radio-row .dot {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--ink); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center;
}
.radio-row[aria-checked="true"] .dot::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); }
.radio-row[aria-checked="true"] { font-weight: 700; }
.soon-tag { display: inline-block; align-self: flex-start; font-weight: 700; border: 2px dashed var(--line); border-radius: 999px; padding: 4px 14px; }
@media (min-width: 900px) {
  .owner .h-check { font-size: 34px; }
}
/* Talk to Us (lane UX6, wireframes s19-s20): the helper's sheet. On a wide
   screen it sits at the right, beside the page it is helping with. */
.sheet-talk { gap: 18px; }
.sheet-talk .mic-sm { width: 150px; height: 150px; font-size: 22px; box-shadow: 0 0 0 12px var(--accent-soft); }
.sheet-talk .mic-wrap.on .mic-sm { box-shadow: 0 0 0 14px var(--accent-soft), 0 0 0 26px var(--fill); }
.sheet-talk .pill-row .btn { width: 100%; }
.sheet-talk .alert { border-left: 6px solid var(--accent); background: var(--accent-soft); color: var(--ink); padding: 12px 14px; border-radius: 8px; font-weight: 700; }
.chat { display: flex; flex-direction: column; gap: 14px; }
.bubble { border-radius: 18px; padding: 14px 18px; max-width: 92%; display: flex; flex-direction: column; gap: 8px; }
.bubble.me { align-self: flex-end; background: var(--fill); border: 2px solid var(--line); }
.bubble.helper { align-self: flex-start; background: var(--accent-soft); color: var(--ink); }
.bubble.care { border: 3px solid var(--accent); }
.bubble-who { font-size: 16px; font-weight: 800; color: var(--muted); }
.bubble.helper .bubble-who { color: var(--ink); }
.bubble .pre { white-space: pre-line; }
.bubble ol.steps { margin-top: 4px; }
.bubble ol.steps li::before { width: 36px; height: 36px; }
@media (min-width: 1000px) {
  .talk-overlay { justify-content: flex-end; align-items: stretch; padding: 24px; }
  .talk-overlay .sheet-talk { max-width: 480px; max-height: none; }
}

/* Pictures, videos and sounds (lane UX3, wireframes s11-s14). The attach and
   check screens use two columns on a computer, so the shell widens for them. */
.shell:has([data-wide]) { max-width: 1100px; }
.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;
}
.md-desk { display: none; }
.md-phone { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) {
  .md-desk { display: flex; flex-direction: column; gap: 16px; }
  .md-phone { display: none; }
  .md-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 32px; align-items: start; }
  .md-cols.md-desk { display: grid; }
  .md-cols-check { grid-template-columns: 3fr 2fr; }
  /* The whole side column sticks, not just the library panel: a sticky panel
     slid over the switches and button after it (MO1 2026-11-20). The column
     fits the window; the library list scrolls inside it when it is long. */
  .md-side-col { position: sticky; top: calc(var(--nav-h, 0px) + 16px); max-height: calc(100vh - 32px - var(--nav-h, 0px)); }
  .md-side-col > * { flex-shrink: 0; }
  .md-side-col > .md-side { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px; }
}
.md-cols > * { min-width: 0; }
.md-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .md-row { grid-template-columns: 1fr 1fr; } }
.md-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 700px) { .md-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.md-grid-side { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
/* The "Add to part n" picker: smaller tiles, 3 across on a phone, 4 on a computer (owner 2026-11-21). */
.md-pick { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px; }
@media (min-width: 700px) { .md-pick { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
.md-pick .md-tile { padding: 6px; }
.md-pick .md-tile-name { font-size: 16px; }
.md-pick .md-use { font-size: 16px; }
.md-pick-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.md-pick-filters .btn-pill { width: auto; flex: 0 0 auto; min-height: 48px; padding: 6px 16px; font-size: 18px; }
/* The chapter's two picture switches, together at the top (owner 2026-11-21). */
.md-switches { padding: 14px 16px; }
.md-switches > * + * { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
.md-top { gap: 14px; }
.md-tile {
  display: flex; flex-direction: column; gap: 6px; width: 100%; height: 100%; min-height: 48px; padding: 8px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
}
.md-drag { cursor: grab; }
.md-thumb {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%;
  aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--fill); color: var(--ink);
}
.md-thumb img, .md-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.md-thumb.md-sound { background: var(--ink); color: var(--bg); }
.md-thumb-small { width: 96px; flex: none; }
.md-badge {
  position: absolute; left: 6px; bottom: 6px; background: var(--ink); color: var(--bg);
  border-radius: 8px; padding: 2px 8px; font-size: 16px; font-weight: 700;
}
.md-sound .md-badge { position: static; background: none; color: inherit; font-size: 18px; }
.md-tile-name { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.md-use { font-size: 17px; color: var(--muted); }
.md-uploads .strong { font-size: 20px; }
.md-failed { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; border-top: 2px solid var(--line); padding-top: 10px; }
.md-drop {
  border: 3px dashed var(--accent); border-radius: var(--radius); padding: 48px 16px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: stretch; background: var(--card);
}
.md-drop.over, .md-addhere.over { background: var(--accent-soft); }
.md-para { font: 21px/1.55 var(--serif); }
.md-placed {
  display: flex; gap: 14px; align-items: center; border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 12px; background: var(--card);
}
.md-placed-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.md-actions { display: flex; flex-wrap: wrap; gap: 0 18px; }
.md-addhere {
  width: 100%; min-height: 64px; border: 3px dashed var(--accent); border-radius: var(--radius);
  background: transparent; color: var(--accent); font: 700 21px/1.3 var(--font); cursor: pointer; padding: 12px;
}
.md-addhere:disabled { opacity: .5; cursor: default; }
.md-big { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: var(--fill); display: block; }
.md-audio { width: 100%; }
.md-wide-sheet { max-width: 900px; }
.md-ctrls { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 12px; }
.md-ctrls .btn { min-height: 64px; padding: 10px; }
.md-play { font-size: 22px; }
.md-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden;
  background: var(--fill); display: flex; align-items: center; justify-content: center; border: 2px solid var(--line);
}
.md-stage img, .md-stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.md-stage-empty { color: var(--muted); padding: 16px; text-align: center; }
.md-stage-name, .md-stage-sound {
  position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px); background: rgba(20, 12, 8, .85);
  color: #fff; border-radius: 10px; padding: 6px 12px; font-size: 18px; font-weight: 700;
}
.md-stage-sound { top: 12px; bottom: auto; background: var(--accent); color: var(--accent-ink); }
.md-caption { font: italic 21px/1.5 var(--serif); }
.md-caption .muted { font-style: normal; font-family: var(--font); }
.md-chapters { margin-top: 12px; }

/* ------------------------------------------------------------------ */
/* Listening (lane UX4, wireframes s15 and s16)                        */
/* ------------------------------------------------------------------ */
.listen h1 { font-size: 34px; }
.ch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.ch {
  display: flex; align-items: center; gap: 18px; padding: 16px 18px;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.ch-play {
  flex: none; width: 96px; height: 96px; border-radius: 50%; padding: 4px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.ch-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ch-title { font: 700 22px/1.3 var(--font); text-decoration: none; overflow-wrap: anywhere; min-height: 48px; display: flex; align-items: center; }
.ch-meta { font-size: 18px; }

.player-head { display: flex; align-items: center; gap: 18px; }
.avatar {
  flex: none; width: 96px; height: 96px; border-radius: 50%; background: var(--fill); border: 2px solid var(--line);
  color: var(--ink); font: 700 44px/1 var(--serif); display: flex; align-items: center; justify-content: center;
}
.player-head h1 { font-size: 30px; overflow-wrap: anywhere; }
@media (max-width: 699px) {
  .player-head { gap: 14px; }
  .player-head .avatar { width: 64px; height: 64px; font-size: 30px; }
  .player-head h1 { font-size: 26px; }
}
.player-pic { margin: 0; }
.player-pic[hidden] { display: none; }
.player-pic img { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: var(--fill); }
@media (min-width: 700px) { .player-pic img { max-height: 320px; } }
/* MO1 picture cycle: two stacked pictures that cross-fade (no fade with reduced motion). */
.cycle-pic { margin: 0; position: relative; height: 220px; border-radius: 12px; overflow: hidden; background: var(--fill); }
.cycle-pic[hidden] { display: none; }
.cycle-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.cycle-img.on { opacity: 1; }
@media (min-width: 700px) { .cycle-pic { height: 320px; } }
@media (prefers-reduced-motion: no-preference) { .cycle-img { transition: opacity .8s ease-in-out; } }
.md-stage .cycle-pic { position: absolute; inset: 0; height: auto; border-radius: 0; background: #000; }

/* MO1 (CSA 2026-11-21): the family's pictures without a story, and full screen
   (lib/fullscreen.js). The picture only, on black; a tap shows the controls. */
.pictures .pictures-frame { height: min(56vh, 520px); background: #000; }
.fs-stage { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; }
.fs-stage:fullscreen { width: 100%; height: 100%; }
.fs-pics { position: absolute; inset: 0; }
.fs-pics > * { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; margin: 0; border-radius: 0; background: #000; }
.fs-pics > [hidden] { display: none; }
.fs-pics .player-pic img, .fs-pics .md-stage img, .fs-pics .md-stage video {
  width: 100%; height: 100%; max-height: none; object-fit: contain; border-radius: 0; background: #000; }
.fs-pics .md-stage { aspect-ratio: auto; border: 0; }
.fs-pics .md-stage-name, .fs-pics .md-stage-sound { display: none; }
.fs-ctrls {
  position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 0 16px;
  opacity: 0; pointer-events: none;
}
.fs-stage.fs-show .fs-ctrls { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: no-preference) { .fs-ctrls { transition: opacity .3s; } }
.fs-btn { min-height: 64px; min-width: 150px; font-size: 22px; }
.fs-ctrls .fs-btn:focus-visible { outline-color: #fff; }
.fs-hint {
  position: absolute; top: max(16px, env(safe-area-inset-top)); left: 16px; right: 16px; margin: 0;
  background: rgba(0, 0, 0, .72); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 18px; text-align: center;
}
body.fs-open { overflow: hidden; }
.player-text { font-size: 22px; line-height: 1.6; display: flex; flex-direction: column; gap: 14px; }
.player-text.big { font-size: 28px; }
.player-text p { margin: 0; }
.sent { border-radius: 6px; cursor: pointer; }
.sent.now { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); padding: 2px 4px; }
.player-controls {
  position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  border-top: 3px solid var(--ink); display: flex; flex-direction: column; gap: 6px;
}
.player-bar-row { display: flex; align-items: center; gap: 12px; }
.player-bar { flex: 1; min-width: 0; height: 48px; accent-color: var(--accent); margin: 0; }
.player-clock { flex: none; margin: 0; white-space: nowrap; }
.player-buttons { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.player-round {
  width: 96px; height: 96px; border-radius: 50%; padding: 4px; font-size: 17px; line-height: 1.15; flex: none;
}
.player-play { width: 104px; height: 104px; border-radius: 50%; padding: 6px; font-size: 20px; font-weight: 800; flex: none; }
.btn:disabled { opacity: .55; cursor: default; }
.listen .btn[hidden] { display: none; }
@media (max-width: 380px) {
  .player-round { width: 80px; height: 80px; font-size: 16px; }
  .player-play { width: 96px; height: 96px; font-size: 18px; }
}

/* ------------------------------------------------------------------ */
/* Printed cards (lane UX4, wireframe s18)                              */
/* ------------------------------------------------------------------ */
.addr-big { font: 800 24px/1.3 var(--font); overflow-wrap: anywhere; }
.psheet-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; }
.psheet { display: grid; grid-template-columns: repeat(2, 3.5in); grid-auto-rows: 2in; width: 7in; margin: 0 auto; background: #fff; color: #111; }
.pcard {
  box-sizing: border-box; width: 3.5in; height: 2in; padding: .14in; border: 1px dashed #777;
  display: flex; align-items: center; gap: .12in; overflow: hidden; font-family: var(--font);
}
.pcard .qr { flex: none; width: 1.25in; height: 1.25in; }
.pcard-text { min-width: 0; display: flex; flex-direction: column; gap: .03in; }
.pcard-title { font: 700 13pt/1.15 var(--serif); }
.pcard-scan { font: 9.5pt/1.25 var(--font); }
.pcard-type { font: 8pt/1.2 var(--font); color: #333; margin-top: .03in; }
.pcard-addr { font: 700 8.5pt/1.2 var(--font); overflow-wrap: normal; word-break: keep-all; }
.pcard-code { font: 8.5pt/1.2 var(--font); }
.pcard-code b { font: 700 9.5pt/1.2 "Courier New", monospace; letter-spacing: .04em; }
@media screen and (max-width: 760px) {
  /* A phone shows the sheet shrunk to fit; the print is always full size. */
  .psheet { zoom: .52; }
}
@media print {
  @page { margin: 0; }
  body { background: #fff; }
  .shell { max-width: none; padding: 0; }
  .top, .topnav, .fs-stage, .banner, .no-print, .card-page > h1, .card-page > p, .card-page > a { display: none !important; }
  .card-page, .card-page .stack { gap: 0; }
  .psheet-wrap { border: 0; padding: 0; overflow: visible; }
  .psheet { margin: .5in auto 0; zoom: 1; }
  .psheet-a4 { margin-top: .85in; }
  .pcard { break-inside: avoid; }
}

/* MG1 (Moments Guidance): the tips card and the pick-one menu before a Moment. */
.moment-tips h2 { font-size: 22px; }
.moment-tips .tips { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; font-size: 20px; }
.moment-group { display: grid; gap: 10px; }
.moment-group h3 { font-size: 19px; font-weight: 700; margin: 0; }
.moment-q { min-height: 56px; justify-content: flex-start; text-align: left; white-space: normal; line-height: 1.35;
            font-size: 19px; padding: 12px 18px; border-radius: 16px; }
