
  /* Light is the home theme. Every color below is a token so the dark
     theme can restate the same palette after dark, and so contrast fixes
     happen in one place. All text pairs meet WCAG AA (4.5:1). */
  :root { color-scheme: light dark;
    --bg1:#fdf3d9; --bg2:#dcedc8; --card:#fffdf7; --ink:#4a4336; --line:#f0e6cc;
    --grass:#478043; --grass-deep:#376a34; --grass-soft:#e3f2dd; --on-grass:#ffffff;
    --sun:#f0b429; --sun-soft:#fdf0c2; --sun-hover:#e0a51f; --sun-ink:#5d4a12;
    --sky:#7fb5d5; --sky-soft:#e3f0f7; --sky-deep:#2f6d94; --on-sky:#ffffff;
    --berry:#9c4a24; --berry-soft:#fae5d8; --plum:#655080; --plum-soft:#efe8f6;
    --muted:#6d6553; --ink-2:#6b6350;
    --surface:#ffffff; --surface-soft:rgba(255,255,255,.7); --surface-2:#fdf9ec; --input-bg:#fffef9;
    --gold-ink:#7a5c10; --gold-ink-2:#7a5c10; --tension-ink:#6f5a1e;
    --danger-line:#eccdb9; --welcome-bg1:#fdf0c2; --welcome-bg2:#f6edd2; --welcome-line:#f0e2b8;
    --note-blue-bg:#f3f7fa; --note-blue-line:#d5e5ef;
    --note-gold-bg:#faf3df; --note-gold-line:#eddfb3;
  }

  /* Dark theme. GreyRocked gets opened at 3am; the garden should be able to
     turn its lights down. Only tokens are restated — never component rules. */
  /* The wordmark is a flat PNG drawn for the cream background, so after dark it
     sits at roughly 2.5:1 and reads as the dullest thing on the page. Lift it
     rather than shipping a second asset. */
  @media (prefers-color-scheme: dark) {
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg1:#1a1d17; --bg2:#12150f; --card:#232720; --ink:#e8e6dc; --line:#3a3f33;
      --grass:#7cc06f; --grass-deep:#9ad48d; --grass-soft:#26361f; --on-grass:#0f1a0d;
      --sun:#e0a83a; --sun-soft:#3a2f12; --sun-hover:#cf9a2e; --sun-ink:#201804;
      --sky:#5d90b0; --sky-soft:#1c2830; --sky-deep:#9fd0ec; --on-sky:#0d1d27;
      --berry:#e59470; --berry-soft:#3b241a; --plum:#c3aede; --plum-soft:#2b2436;
      --muted:#a49b86; --ink-2:#b8b1a0;
      --surface:#2a2f26; --surface-soft:rgba(255,255,255,.06); --surface-2:#262b21; --input-bg:#1e221a;
      --gold-ink:#edd39a; --gold-ink-2:#edd39a; --tension-ink:#dcc79a;
      --danger-line:#5a3b2c; --welcome-bg1:#2c3020; --welcome-bg2:#242a1b; --welcome-line:#46502f;
      --note-blue-bg:#1b242b; --note-blue-line:#34464f;
      --note-gold-bg:#2c2617; --note-gold-line:#4a3f22;
    }
  }

  /* An explicit choice wins over the operating system, in both directions. */
  :root[data-theme="dark"] {
    --bg1:#1a1d17; --bg2:#12150f; --card:#232720; --ink:#e8e6dc; --line:#3a3f33;
    --grass:#7cc06f; --grass-deep:#9ad48d; --grass-soft:#26361f; --on-grass:#0f1a0d;
    --sun:#e0a83a; --sun-soft:#3a2f12; --sun-hover:#cf9a2e; --sun-ink:#201804;
    --sky:#5d90b0; --sky-soft:#1c2830; --sky-deep:#9fd0ec; --on-sky:#0d1d27;
    --berry:#e59470; --berry-soft:#3b241a; --plum:#c3aede; --plum-soft:#2b2436;
    --muted:#a49b86; --ink-2:#b8b1a0;
    --surface:#2a2f26; --surface-soft:rgba(255,255,255,.06); --surface-2:#262b21; --input-bg:#1e221a;
    --gold-ink:#edd39a; --gold-ink-2:#edd39a; --tension-ink:#dcc79a;
    --danger-line:#5a3b2c; --welcome-bg1:#2c3020; --welcome-bg2:#242a1b; --welcome-line:#46502f;
    --note-blue-bg:#1b242b; --note-blue-line:#34464f;
    --note-gold-bg:#2c2617; --note-gold-line:#4a3f22;
  }
  * { box-sizing:border-box; margin:0; padding:0; }
  html { min-height:100%; }
  body { background:var(--bg1); color:var(--ink);
    font-family:"Trebuchet MS", Verdana, "Segoe UI", sans-serif; font-size:15.5px; line-height:1.65; }
  body::before { content:''; position:fixed; inset:0; z-index:-1;
    background:linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%); }
  .wrap { max-width:780px; margin:0 auto; padding:30px 20px 70px; }

  /* ---------- Sprout & speech ---------- */
  .hero { display:flex; align-items:center; justify-content:center; gap:16px; margin-bottom:8px; flex-wrap:wrap; }
  .sprout { width:86px; height:86px; flex-shrink:0; filter:drop-shadow(0 3px 4px rgba(90,80,50,.18)); animation:bob 3.5s ease-in-out infinite; }
  @keyframes bob { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }
  .bubble { position:relative; background:var(--surface); border:2.5px solid var(--line); border-radius:22px 24px 22px 4px; padding:14px 20px;
    max-width:520px; font-size:15.5px; box-shadow:0 4px 14px rgba(90,80,50,.1); }
  .bubble.right { border-radius:24px 22px 4px 22px; }
  h1.logo { text-align:center; font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif; font-size:34px; color:var(--grass-deep);
    letter-spacing:.5px; margin-bottom:2px; }
  .tagline { text-align:center; color:var(--muted); font-size:16px; margin-bottom:18px; }

  nav.tabs { display:flex; gap:8px; justify-content:center; margin-bottom:24px; flex-wrap:wrap; }
  nav.tabs button { background:var(--surface); border:2px solid var(--line); padding:10px 18px; font-size:14.5px; font-weight:700;
    font-family:inherit; color:var(--ink-2); cursor:pointer; border-radius:99px; transition:all .25s ease; }
  nav.tabs button:hover { border-color:var(--grass); color:var(--grass-deep); transform:translateY(-1px); }
  nav.tabs button.active { color:var(--on-grass); background:var(--grass); border-color:var(--grass); box-shadow:0 4px 12px rgba(91,158,88,.35); }

  .card { background:var(--card); border:2.5px solid var(--line); border-radius:26px 30px 26px 28px; padding:24px 26px; margin-bottom:18px;
    box-shadow:0 5px 18px rgba(90,80,50,.09); animation:rise .45s ease both; }
  @keyframes rise { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }
  h1, h2, h3 { text-wrap:balance; }
  h2 { font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif; font-size:20px; color:var(--grass-deep); margin-bottom:8px; }
  h3 { font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif; font-size:16px; color:var(--grass-deep); margin-bottom:6px; }
  .q { display:block; font-size:15px; font-weight:700; color:var(--ink); margin:18px 0 8px; }
  .q .sub { display:block; font-weight:400; font-size:16px; color:var(--muted); }
  input[type=text], input[type=password], textarea, select { width:100%; padding:12px 15px; border:2px solid var(--line); border-radius:16px; font-size:14.5px;
    font-family:inherit; background:var(--input-bg); color:var(--ink); transition:border-color .2s, box-shadow .2s; }
  input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus { outline:none; border-color:var(--grass); box-shadow:0 0 0 4px var(--grass-soft); }
  button:focus-visible, a:focus-visible { outline:3px solid var(--sky-deep); outline-offset:2px; border-radius:8px; }
  textarea { resize:vertical; min-height:88px; }
  /* Big handles: the native thumb is a few pixels wide and easy to miss with a thumb. */
  input[type=range] { width:100%; accent-color:var(--grass); -webkit-appearance:none; appearance:none;
    height:36px; background:transparent; }
  input[type=range]::-webkit-slider-runnable-track { height:8px; border-radius:8px; background:var(--line); }
  input[type=range]::-moz-range-track { height:8px; border-radius:8px; background:var(--line); }
  input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; width:30px; height:30px; margin-top:-11px;
    border-radius:50%; background:var(--grass); border:3px solid var(--surface); box-shadow:0 1px 4px rgba(0,0,0,.25); }
  input[type=range]::-moz-range-thumb { width:26px; height:26px; border-radius:50%; background:var(--grass);
    border:3px solid var(--surface); }
  .row { display:flex; gap:14px; flex-wrap:wrap; }
  .row > div { flex:1; min-width:160px; }
  .btn { display:inline-block; background:var(--grass); color:var(--on-grass); border:none; border-radius:99px; padding:13px 26px; font-size:15.5px;
    font-weight:700; font-family:inherit; cursor:pointer; transition:all .22s ease; box-shadow:0 4px 12px rgba(91,158,88,.35); }
  .btn:hover:not(:disabled) { background:var(--grass-deep); transform:translateY(-2px) scale(1.02); box-shadow:0 6px 18px rgba(91,158,88,.45); }
  .btn:active:not(:disabled) { transform:translateY(0) scale(.98); }
  .btn:disabled { opacity:.5; cursor:default; }
  body.plain-home .door[data-view="hold"], body.plain-home .door[data-view="log"] .d-sub, body.plain-home #bottom-nav [data-view="hold"], body.plain-home .parent-line { display:none; }
  .shared-phone-note { text-align:center; font-size:16px; margin:4px 0 10px; }
  .shared-phone-note .toggle-link { display:inline-flex; align-items:center; min-height:44px; padding:0 4px; }
  .btn.ghost { background:var(--surface); color:var(--grass-deep); border:2px solid var(--grass); box-shadow:none; }
  .btn.ghost:hover:not(:disabled) { background:var(--grass-soft); }
  .btn.small { padding:7px 14px; font-size:12.5px; min-height:44px; }   /* v4.4: 44px tap target (was 33px) */
  .btn.danger { background:var(--surface); color:var(--berry); border:2px solid var(--danger-line); box-shadow:none; }
  .btn.danger:hover:not(:disabled) { background:var(--berry-soft); transform:none; }
  .btn.sun { background:var(--sun); color:var(--sun-ink); box-shadow:0 4px 12px rgba(240,180,41,.4); }
  .btn.sun:hover:not(:disabled) { background:var(--sun-hover); }

  .chips { display:flex; flex-wrap:wrap; gap:9px; }
  .chip { min-height:44px; padding:11px 17px; border-radius:99px; border:2px solid var(--line); background:var(--surface); cursor:pointer; font-size:14px;
    font-family:inherit; color:var(--ink); transition:all .16s ease; user-select:none; font-weight:600; }
  .chip:hover { border-color:var(--grass); transform:translateY(-1px); }
  .chip.on { background:var(--grass); color:var(--on-grass); border-color:var(--grass); box-shadow:0 3px 10px rgba(91,158,88,.3); transform:scale(1.03); }
  .chip.big { font-size:15px; padding:12px 19px; }
  .chip.heart.on { background:var(--sky-deep); color:var(--on-sky); border-color:var(--sky); box-shadow:0 3px 10px rgba(127,181,213,.4); }
  /* A picked chip says so in shape as well as color (tester Daniel: "buttons don't show they've been picked").
     The tick is decoration; aria-pressed already tells a screen reader. */
  .chip.on::before { content:'\2713\00a0'; content:'\2713\00a0' / ''; }
  .btn.small.tray-btn { min-height:44px; }
  /* v4.5: "Copied \2713" is wider than "Copy"; a stable width keeps the row from reflowing and wrapping "+ Add to my reply". */
  .btn.copy-btn { min-width:96px; text-align:center; }

  .pill { display:inline-block; padding:5px 14px; border-radius:99px; font-size:12.5px; font-weight:700; }
  /* the verdict is the answer they came for, so it leads */
  .verdict-line { display:block; margin:0 0 14px; }
  .verdict-line .pill { font-size:17px; padding:10px 22px; border-radius:16px; letter-spacing:.2px; }
  .pill.respond { background:var(--grass-soft); color:var(--grass-deep); }
  .pill.wait { background:var(--sun-soft); color:var(--gold-ink-2); }
  .pill.ignore { background:var(--plum-soft); color:var(--plum); }
  .pill.tactic { background:var(--berry-soft); color:var(--berry); margin:2px 5px 2px 0; }
  .muted { color:var(--muted); font-size:16px; }
  .slider-val { font-weight:700; color:var(--grass-deep); font-size:13px; }
  .person-card { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
  .draft { background:var(--surface-2); border:2px solid var(--line); border-radius:18px; padding:16px; margin-top:10px; }
  .draft .reg { font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:1px; margin-bottom:5px; }
  .draft p { white-space:pre-wrap; }
  /* v5.2 (J-1816, owner's test: "show this person speaking and that person speaking"): a back-and-forth reads as a chat,
     their words on the left, yours on the right, instead of a wall of text. Uses the existing color tokens. */
  .talk { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
  .talk .bub { max-width:88%; padding:10px 14px; border-radius:18px; border:2px solid; color:var(--ink); white-space:normal; }
  .talk .bub .who, .talk .bub .reg { display:block; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:3px; }
  .talk .them { align-self:flex-start; background:var(--note-blue-bg); border-color:var(--note-blue-line); border-bottom-left-radius:6px; }
  .talk .me { align-self:flex-end; background:var(--grass-soft); border-color:var(--grass); border-bottom-right-radius:6px; }
  .talk .quiet { align-self:center; font-size:16px; color:var(--muted); font-style:italic; }
  /* v5.3 (J-2395): the reply options are your side of the chat, one bubble each, with "or" between them;
     long notes come in short pieces instead of one block. */
  .draft.reply-opt { background:none; border:none; padding:0; display:flex; flex-direction:column; align-items:flex-end; }
  .draft.reply-opt .reg { margin:0 4px 4px; }
  .draft.reply-opt .say { max-width:88%; padding:10px 14px; border:2px solid var(--grass); border-radius:18px; border-bottom-right-radius:6px;
    background:var(--grass-soft); color:var(--ink); }
  .draft.reply-opt + .draft.reply-opt::before { content:'or'; align-self:center; margin:2px 0 6px; font-size:13px; font-weight:700;
    color:var(--muted); text-transform:uppercase; letter-spacing:1px; }
  .draft.reply-opt .opt-btns { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
  .reply-them { margin:4px 0 12px; }
  /* My book: their words on the left, your reply on the right, like the rest of the app. */
  .log-item .log-said, .log-item .log-reply { width:fit-content; max-width:88%; padding:10px 14px; border:2px solid; border-radius:18px; color:var(--ink); }
  .log-item .log-said { background:var(--note-blue-bg); border-color:var(--note-blue-line); border-bottom-left-radius:6px; }
  .log-item .log-reply { white-space:pre-line !important; margin-left:auto; background:var(--grass-soft); border-color:var(--grass); border-bottom-right-radius:6px; }
  .log-item .log-said .who, .log-item .log-reply > .muted:first-child { display:block; font-size:12px; font-weight:700; text-transform:uppercase;
    letter-spacing:1px; color:var(--muted); margin-bottom:3px; }
  .pieces p + p { margin-top:9px; }
  #view-privacy .card > p.mt > strong:first-child, #view-safety .card > p > strong:first-child { display:block; color:var(--grass-deep); margin-bottom:2px; }
  #view-privacy .card > p.mt { margin-top:14px; }
  .tactic-item div.ev { display:inline-block; max-width:88%; margin:6px 0; padding:8px 12px; border:2px solid var(--note-blue-line);
    border-radius:16px; border-bottom-left-radius:6px; background:var(--note-blue-bg); color:var(--ink); font-style:normal; font-size:14px; }
  .crisis-card { background:var(--note-blue-bg); border:2px solid var(--note-blue-line); border-left:6px solid var(--grass-deep); }
  .crisis-card h3 { font-size:16px; color:var(--ink); margin-bottom:6px; }
  .crisis-card p { white-space:normal; }
  .crisis-card a { color:var(--grass-deep); font-weight:700; text-decoration:underline; }
  /* 44px tap targets with padding only: a hurried thumb must hit 988 first time. Negative margins keep the line spacing. */
  .crisis-card p a { display:inline-block; min-height:44px; min-width:44px; padding:12px 6px; margin:-12px 0; box-sizing:border-box; text-align:center; }
  /* "Sudden emergency" help line: the same look as .crisis-card, under its own class so a crisis comeback still adds the full card. */
  .emergency-help, .last-attempt-help { background:var(--note-blue-bg); border:2px solid var(--note-blue-line); border-left:6px solid var(--grass-deep); }
  .emergency-help p, .last-attempt-help p { white-space:normal; }
  .emergency-help a, .last-attempt-help a { color:var(--grass-deep); font-weight:700; text-decoration:underline; }
  .emergency-help p a, .last-attempt-help p a { display:inline-block; min-height:44px; min-width:44px; padding:12px 6px; margin:-12px 0; box-sizing:border-box; text-align:center; }
  .emergency-help .safety-taps { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
  .emergency-help .safety-taps a { display:inline-flex; align-items:center; min-height:44px; padding:10px 14px; box-sizing:border-box; border:2px solid var(--note-blue-line); border-radius:14px; background:var(--surface); color:var(--ink); font-weight:700; text-decoration:none; }
  .tactic-item { border-left:4px solid var(--danger-line); padding:8px 0 8px 14px; margin:10px 0; border-radius:2px; }
  .tactic-item .ev { font-style:italic; color:var(--muted); font-size:16px; }
  .log-item { border-bottom:2px dashed var(--line); padding:14px 0; }
  .log-item:last-child { border-bottom:none; }
  .log-head { display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap; }
  .empty { text-align:center; color:var(--muted); padding:34px 10px; }
  footer { text-align:center; color:var(--muted); font-size:12.5px; margin-top:36px; }
  .hidden { display:none !important; }
  .mt { margin-top:14px; }
  .toggle-link { background:none; border:none; color:var(--grass-deep); font-size:13px; cursor:pointer; text-decoration:underline; padding:0; font-family:inherit; }
  /* skip / back / more links on their own line: 44px tap area, same look */
  .mt > .toggle-link, .lock-forgot > .toggle-link { display:inline-flex; align-items:center; min-height:44px; min-width:44px; padding:12px 0; text-align:left; }
  /* Safety page: every number and helpline is a 44px tap target (same pattern as .crisis-card p a). */
  #view-contact p a { color:var(--grass-deep); font-weight:700; text-decoration:underline; }
  #view-safety p a { color:var(--grass-deep); font-weight:700; text-decoration:underline; display:inline-block; min-height:44px; min-width:44px; padding:12px 4px; margin:-12px 0; box-sizing:border-box; text-align:center; }
  #view-safety .safety-taps { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
  #view-safety .safety-taps a { display:inline-flex; align-items:center; min-height:44px; padding:10px 14px; box-sizing:border-box; border:2px solid var(--note-blue-line); border-radius:14px; background:var(--note-blue-bg); color:var(--ink); font-weight:700; text-decoration:none; }
  .posture-desc { font-size:16px; color:var(--muted); margin-top:6px; min-height:18px; }

  /* breathing moment */
  .breathe-box { text-align:center; padding:26px 20px 30px; }
  .breathe-ring { width:120px; height:120px; margin:14px auto; border-radius:50%; background:var(--sky-soft); border:3px solid var(--sky);
    display:flex; align-items:center; justify-content:center; animation:breathe 8s ease-in-out infinite; }
  .breathe-ring .sprout { width:64px; height:64px; animation:none; }
  @keyframes breathe { 0%,100% { transform:scale(1); } 50% { transform:scale(1.28); } }
  .breathe-text { font-size:17px; font-weight:700; color:var(--sky-deep); margin-top:8px; min-height:26px; transition:opacity .8s; }

  /* celebration */
  .confetti-piece { position:fixed; top:-30px; font-size:22px; z-index:999; animation:fall linear forwards; pointer-events:none; }
  @keyframes fall { to { transform:translateY(110vh) rotate(340deg); opacity:.7; } }
  .cheer { display:flex; align-items:center; gap:14px; margin-top:14px; animation:rise .4s ease both; }

  /* welcome banner */
  .welcome { background:linear-gradient(135deg, var(--welcome-bg1) 0%, var(--welcome-bg2) 100%); border:2.5px solid var(--welcome-line);
    border-radius:24px; padding:18px 24px; margin-bottom:18px; text-align:center; color:var(--gold-ink);
    box-shadow:0 4px 14px rgba(90,80,50,.08); animation:rise .45s ease both; }
  .welcome .big { font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif; font-size:18px; font-weight:700; margin-bottom:3px; }
  .welcome .small { font-size:16px; }   /* no opacity: it dropped this to 4.11:1. Size carries the hierarchy. */

  /* home doors */
  .doors { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:18px; }
  @media (max-width:560px){ .doors { grid-template-columns:1fr; } }
  .door { background:var(--card); border:2.5px solid var(--line); border-radius:26px; padding:22px 20px; cursor:pointer;
    text-align:left; font-family:inherit; transition:all .22s ease; box-shadow:0 5px 18px rgba(90,80,50,.09); display:block; width:100%; }
  .door:hover { transform:translateY(-3px); border-color:var(--grass); box-shadow:0 8px 24px rgba(91,158,88,.2); }
  .door .d-emoji { font-size:30px; display:block; margin-bottom:8px; }
  .door .d-title { display:block; font-family:"Arial Rounded MT Bold","Trebuchet MS",sans-serif; font-size:17px; color:var(--grass-deep); font-weight:700; }
  .door .d-sub { display:block; font-size:16px; color:var(--muted); margin-top:3px; }
  /* "Worried someone might hurt themselves?": full width under the doors, straight to the Safety page. Plain home never hides it. */
  .door.door-safety { grid-column:1 / -1; min-height:44px; padding:16px 20px; background:var(--note-blue-bg); border-color:var(--note-blue-line); }
  .door.door-safety .d-title { color:var(--ink); }
  .door.door-safety .d-sub { color:var(--ink-2); }
  .minibar { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-top:6px; }
  .mini { background:var(--surface-soft); border:1.5px solid var(--line); padding:11px 16px; font-size:13px; font-weight:600;
    min-height:44px;
    color:var(--ink-2); cursor:pointer; border-radius:99px; font-family:inherit; transition:all .2s ease; }
  .mini:hover { color:var(--grass-deep); border-color:var(--grass); background:var(--surface); }
  .backbar { margin-bottom:14px; }
  .stepno { font-size:12px; font-weight:700; color:var(--muted); letter-spacing:1px; margin-bottom:6px; }
  .tension { background:var(--sun-soft); border:2.5px solid var(--sun); border-radius:18px; padding:14px 18px; margin-top:12px;
    animation:rise .35s ease both; }
  .tension .t-head { font-weight:700; color:var(--gold-ink); font-size:15px; margin-bottom:4px; }
  .tension .t-body { color:var(--tension-ink); font-size:16px; }
  .patch { border-bottom:2px dashed var(--line); padding:18px 0; }
  .patch:last-child { border-bottom:none; }
  .patch h3 { font-size:18px; margin-bottom:2px; }
  .patch .ver { font-size:12px; color:var(--muted); font-weight:700; letter-spacing:.5px; text-transform:uppercase; margin-bottom:8px; }
  .patch ul { list-style:none; margin-top:6px; }
  .patch li { padding:4px 0 4px 2px; }
  .wins { text-align:center; font-size:14px; color:var(--gold-ink-2); background:var(--sun-soft); border-radius:99px; display:inline-block; padding:6px 18px; font-weight:700; }
  /* floating Sprout companion — rides the scrollbar like a little elevator */
  #sprout-fab { position:fixed; top:70px; right:12px; z-index:60; cursor:pointer; transition:top .18s ease-out; }
  .promise { margin-top:14px; padding:16px 18px; background:var(--surface-soft);
    border-left:4px solid var(--grass); border-radius:4px 16px 16px 4px;
    white-space:pre-wrap; line-height:1.62; color:var(--ink); font-size:15px; }
  #update-bar { position:fixed; left:12px; right:12px; bottom:12px; z-index:120;
    display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:center;
    background:var(--surface); border:2.5px solid var(--grass); border-radius:18px;
    padding:12px 16px; box-shadow:0 8px 24px rgba(90,80,50,.22); font-size:14px;
    color:var(--ink); animation:rise .3s ease both; }
  #update-bar span { font-weight:600; }
  #fab-hint { position:fixed; z-index:59; background:var(--surface); border:2px solid var(--sun); border-radius:16px 16px 4px 16px;
    padding:9px 14px; font-size:13px; font-weight:600; color:var(--gold-ink); box-shadow:0 4px 14px rgba(90,80,50,.18);
    max-width:190px; animation:rise .4s ease both; transition:top .18s ease-out;
    pointer-events:none; }
  #sprout-fab .sprout { width:58px; height:58px; animation:bob 3.5s ease-in-out infinite; filter:drop-shadow(0 3px 5px rgba(90,80,50,.25)); }
  #sprout-fab:hover .sprout { animation-duration:1.2s; }
  #fab-menu { position:fixed; bottom:86px; right:16px; z-index:60; background:var(--surface); border:2.5px solid var(--line);
    border-radius:20px 20px 4px 20px; padding:14px; box-shadow:0 8px 24px rgba(90,80,50,.22); width:235px; animation:rise .22s ease both;
    max-height:calc(100vh - 120px); overflow-y:auto; }
  #fab-menu .fm-word { font-size:16px; color:var(--muted); font-style:italic; margin-bottom:10px; line-height:1.5; }
  #fab-menu .mini { display:block; width:100%; text-align:left; margin-bottom:6px; }

  .mic-btn { min-height:44px; background:var(--surface); border:2px solid var(--line); border-radius:99px; padding:9px 16px; font-family:inherit;
    font-size:13.5px; font-weight:700; color:var(--grass-deep); cursor:pointer; margin-top:8px; transition:all .2s ease; display:inline-block; }
  .mic-btn:hover { border-color:var(--grass); }
  /* v4.5.0 Design fix: the Undo toast gets its own line and a 44px target (.hidden still wins: !important). */
  #tray-undo-btn { display:inline-flex; align-items:center; min-height:44px; min-width:44px; padding:0 8px; }
  #tray-undo { display:block; }
  .mic-btn.listening { background:var(--berry-soft); border-color:var(--berry); color:var(--berry); animation:pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 50% { transform:scale(1.05); } }

  /* mobile tuning */
  @media (max-width:600px){
    .wrap { padding:18px 14px 56px; }
    .card { padding:20px 16px 18px; border-radius:22px; }
    h1.logo { font-size:28px; }
    .sprout { width:70px; height:70px; }
    .bubble { max-width:100%; }
    input[type=text], textarea, select { font-size:16px; }   /* stops iPhone auto-zoom on focus */
    .btn { display:block; width:100%; text-align:center; }   /* thumb-sized main actions */
    .btn.small { display:inline-block; width:auto; }
    .person-card { flex-wrap:wrap; }
    .chip.big { font-size:14.5px; padding:12px 16px; }
  }
  footer .foot-love { font-style:italic; margin-bottom:10px; }
  footer .foot-links { display:flex; gap:6px; justify-content:center; align-items:center; flex-wrap:wrap; }
  .flink { background:none; border:none; color:var(--grass-deep); font-size:13px; font-weight:600; cursor:pointer;
    font-family:inherit; padding:11px 12px; min-height:44px; border-radius:8px; }
  .flink:hover { background:var(--grass-soft); }
  .foot-dot { color:var(--line); }
  /* passcode gate - a curtain, deliberately not a vault (see the copy) */
  body.locked .wrap { visibility:hidden; }
  /* ...except the way out. The lock screen tells you to use it. */
  body.locked #leave-fixed { visibility:visible; }
  /* v4.7: the lock screen shows only the lock, Help lines and Leave. No Sprout corner button, no "Psst" bubble. */
  body.locked #sprout-fab, body.locked #fab-hint, body.locked #fab-menu { display:none !important; }
  #lock-screen { position:fixed; inset:0; z-index:200; background:var(--bg1);
    display:flex; align-items:center; justify-content:center; padding:24px; }
  #lock-screen .lock-card { background:var(--card); border:2.5px solid var(--line); border-radius:26px;
    padding:30px 28px; max-width:380px; width:100%; text-align:center; box-shadow:0 5px 18px rgba(90,80,50,.12); }
  #lock-screen .sprout { width:76px; height:76px; margin:0 auto 10px; }
  #lock-screen h2 { margin-bottom:6px; }
  #lock-screen input { text-align:center; letter-spacing:.4em; font-size:20px; margin-top:14px; }
  #lock-screen .lock-msg { min-height:20px; margin-top:10px; font-size:13.5px; color:var(--berry); font-weight:600; }
  #lock-screen .lock-forgot { margin-top:16px; }
  /* Help lines panel inside the lock screen: fixed text only (O-20261011-70 b) */
  #lock-screen { overflow-y:auto; }
  #lock-screen .lock-card { margin:auto; }
  #lock-screen #lock-help { text-align:left; }
  #lock-screen #lock-help h2 { text-align:center; }
  #lock-screen #lock-help p a { color:var(--grass-deep); font-weight:700; text-decoration:underline; display:inline-block; min-height:44px; min-width:44px; padding:12px 4px; margin:-12px 0; box-sizing:border-box; text-align:center; }
  #lock-screen #lock-help .safety-taps { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
  #lock-screen #lock-help .safety-taps a { display:inline-flex; align-items:center; min-height:44px; padding:10px 14px; box-sizing:border-box; border:2px solid var(--note-blue-line); border-radius:14px; background:var(--note-blue-bg); color:var(--ink); font-weight:700; text-decoration:none; }
  #lock-screen #lock-help-open, #lock-screen #lock-help-back { min-height:44px; min-width:44px; }

  .storage-warn { background:var(--note-gold-bg); border:2.5px solid var(--note-gold-line); border-radius:20px;
    padding:14px 18px; margin-bottom:16px; font-size:16px; color:var(--ink); line-height:1.55; }
  .flink.leave { color:var(--berry); border:1.5px solid var(--danger-line); }
  .flink.leave:hover { background:var(--berry-soft); }
  /* Quick exit that never needs a scroll to find - top corner, above everything,
     the passcode curtain included. */
  #leave-fixed { position:fixed; top:8px; right:8px; z-index:210; font-size:13px; font-weight:700;
    padding:7px 12px; border-radius:999px; background:var(--surface); color:var(--berry);
    border:1.5px solid var(--danger-line); cursor:pointer; font-family:inherit;
    min-height:44px; min-width:44px; display:inline-flex; align-items:center; justify-content:center; }
  /* On a phone the corner button sat on the title; start the page below it (button ends at 52px). */
  @media (max-width:600px){ .wrap { padding-top:60px; } }
  #leave-fixed:hover { background:var(--berry-soft); }
  .copy-hint { font-size:16px; margin-top:8px; }
  #leave-hint { position:fixed; top:60px; right:8px; z-index:209; background:var(--surface); border:2px solid var(--sun);
    border-radius:16px 4px 16px 16px; padding:9px 14px; font-size:13px; font-weight:600; color:var(--gold-ink);
    box-shadow:0 4px 14px rgba(90,80,50,.18); max-width:220px; pointer-events:none; animation:rise .4s ease both; }
  /* Narrow screens: no free corner, so the tip sits in the page above the greeting and covers nothing. */
  @media (max-width:760px){ #leave-hint { position:static; max-width:none; margin:0 0 12px; border-radius:16px; } }
  .flash { border:2px solid var(--line); border-radius:18px; padding:16px; margin-top:12px; }
  .event-grid input { margin-top:4px; }
  .chip.posture-chip { display:block; width:100%; text-align:left; }
  .chip-desc { display:block; font-size:16px; font-weight:400; margin-top:3px; }
  .log-foot { display:flex; justify-content:flex-end; margin-top:10px; }
  /* v4.6 design polish: 44px tap targets, breathing room, quote in normal case */
  .log-foot .toggle-link { display:inline-flex; align-items:center; min-height:44px; min-width:44px; padding:0 4px; }
  input[type=date] { min-height:44px; }
  .bk-clip-note { margin-top:8px; margin-bottom:8px; }
  .draft .said-quote { margin:0 0 8px; }

  /* Sprout bobs, breathes and throws confetti. If the reader has asked their
     system for less movement, Sprout sits still — the words do the work. */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration:.001ms !important; animation-iteration-count:1 !important;
      transition-duration:.001ms !important; scroll-behavior:auto !important;
    }
    .breathe-ring { transform:none !important; }
    .confetti-piece { display:none !important; }
  }

  /* On a phone the content column IS the screen, so a floating companion
     would sit on top of the words. Below 640px Sprout docks in the corner. */
  @media (max-width:640px) {
    #sprout-fab .sprout { width:48px; height:48px; }
    /* the docked Sprout sits over the last lines of the page otherwise */
    .wrap { padding-bottom:84px; }
    #fab-menu { width:min(235px, calc(100vw - 32px)); }
  }
