*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: var(--text-size); line-height: 1.5;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--font-display); font-weight: 400; color: var(--text); margin: 0; }
p { margin: 0; }
a { color: var(--action); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.demo-bar {
  background: var(--action); color: var(--action-text);
  text-align: center; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 6px 12px; position: sticky; top: 0; z-index: 10;
}
.shell { max-width: 480px; margin: 0 auto; padding: 0 20px 32px; min-height: calc(100vh - 34px); display: flex; flex-direction: column; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 12px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { width: 30px; height: 20px; flex: none; }
.brand-name { font-weight: 600; font-size: 1rem; line-height: 1.2; }
.brand-ai { font-size: 0.8125rem; color: var(--text-muted); }
.quick-exit {
  min-height: var(--target); padding: 8px 14px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); font-weight: 600; font-size: 0.875rem;
}
.quick-exit:hover { background: var(--card); }

main { flex: 1; display: flex; flex-direction: column; padding-top: 20px; }
.art { display: block; width: 100%; height: auto; border-radius: var(--radius-lg); margin-bottom: 24px; }
.art .sky { fill: var(--surface); } .art .sun { fill: var(--card); opacity: 0.75; } .art .halo { fill: var(--card); opacity: 0.28; } .art .mist { fill: var(--glow); } .art .hill { fill: var(--accent); opacity: 0.22; } .art .land { fill: var(--surface-2); }
.art { box-shadow: var(--shadow); }
.art .mark, .brand .mark { fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }

h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.01em; }
.lede { color: var(--text-muted); margin-top: 8px; }
.eyebrow { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }

.choices { display: grid; gap: 12px; margin-top: 22px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  min-height: 54px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--border); font-size: 1rem; font-weight: 500; box-shadow: var(--shadow);
}
.choice svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.choice .chev { margin-left: auto; width: 15px; height: 15px; opacity: 0.7; }
.choice.primary { background: var(--action); color: var(--action-text); border-color: var(--action); }
.choice:hover { border-color: var(--action); }

.meta { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 20px; color: var(--text-muted); font-size: 0.9375rem; }
.meta button { background: none; border: 0; color: inherit; min-height: var(--target); padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }

.urgent-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; margin-top: 12px; padding: 12px 18px;
  border-radius: 999px; border: 0; position: sticky; bottom: 14px; z-index: 4;
  background: var(--urgent); color: var(--urgent-text); font-weight: 600; font-size: 1rem; text-align: center; text-decoration: none;
  box-shadow: 0 6px 18px rgba(191, 70, 70, 0.22), 0 0 0 4px var(--bg);
}
.urgent-btn:hover { filter: brightness(1.06); }
.urgent-btn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--urgent-text); opacity: 0.9; }
.spacer { flex: 1; min-height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 20px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); font-weight: 600; text-decoration: none; color: var(--text);
}
.btn.primary { background: var(--action); color: var(--action-text); border-color: var(--action); }
.btn.urgent { background: var(--urgent); color: var(--urgent-text); border-color: var(--urgent); width: 100%; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; min-height: var(--target); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; align-self: center; margin-top: 8px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-top: 14px; box-shadow: var(--shadow); }
.card h2 { font-family: var(--font-ui); font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.card.danger { background: var(--urgent-surface); border-color: var(--urgent-border); }
.card.danger h2 { color: var(--accent-text); }
.card p + .btn, .card p + p { margin-top: 12px; }

.pill { display: inline-block; align-self: flex-start; padding: 5px 14px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 14px; }
.pill.urgent { background: var(--urgent-surface); color: var(--accent-text); }
.pill.notice { background: var(--notice); color: var(--notice-text); }

.day { text-align: center; color: var(--text-muted); font-size: 0.875rem; margin-bottom: 12px; }
.bubble { max-width: 86%; padding: 11px 15px; border-radius: 18px; margin-top: 10px; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--surface); border-bottom-right-radius: 6px; }
.bubble.system { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.thread { display: flex; flex-direction: column; }

.evidence { margin-top: 12px; }
.evidence summary { min-height: var(--target); display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.evidence dl { margin: 4px 0 0; display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 6px 14px; font-size: 0.9375rem; }
.evidence dt { color: var(--text-muted); }
.evidence dd { margin: 0; overflow-wrap: anywhere; }

.composer { display: flex; gap: 8px; margin-top: 16px; }
.composer label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.composer input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--text-muted); background: var(--card); font: inherit; color: var(--text); }
.composer input::placeholder { color: var(--text-muted); opacity: 1; }
.composer button { min-width: 48px; min-height: 48px; border-radius: 999px; border: 0; background: var(--action); color: var(--action-text); font-weight: 600; padding: 0 18px; }
.error { color: var(--accent-text); font-weight: 600; margin-top: 10px; }
.plain-list { margin: 8px 0 0; padding-left: 20px; }
.plain-list li + li { margin-top: 6px; }
.small { font-size: 0.9375rem; color: var(--text-muted); }
.center { text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .choice, .btn, .urgent-btn, .quick-exit { transition: background-color 120ms ease, border-color 120ms ease; }
}

/* conversation replies */
.reply-next { margin-top: 8px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { min-height: var(--target); padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-weight: 600; font-size: 0.9375rem; }
.chip:hover { border-color: var(--action); }
.why { margin-top: 6px; font-size: 0.9375rem; max-width: 100%; }
.why summary { min-height: var(--target); display: inline-flex; align-items: center; color: var(--text-muted); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.why dl { margin: 0 0 6px; display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: 6px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.why dt { color: var(--text-muted); } .why dd { margin: 0; overflow-wrap: anywhere; }
.status-ref { font-size: 0.9375rem; color: var(--text-muted); margin-top: 8px; }
.status-text { font-size: 1rem; font-weight: 600; }
.card .card { margin-top: 12px; }
.sending { color: var(--text-muted); font-size: 0.9375rem; margin-top: 10px; }

#main:focus { outline: none; }
.thread .card.danger { scroll-margin-top: 48px; }
.card.danger h2 + p { margin-bottom: 10px; }
.card.danger .btn + h2 { margin-top: 18px; }

.btn.nhs { margin-top: 10px; background: #005EB8; color: #fff; border-color: #005EB8; width: 100%; text-align: center; font-size: 0.9375rem; }
.lede, .small, .meta { font-size: 0.9375rem; }
.small { font-size: 0.875rem; }
.frame-note { display: none; }

/* On a wide screen, show the web companion inside a phone so it reads as the
   mobile experience it is. On a real phone it simply fills the screen. */
@media (min-width: 820px) and (min-height: 640px) {
  body { background: radial-gradient(1200px 700px at 50% 0%, var(--glow), var(--bg) 60%), var(--bg); min-height: 100vh; }
  .shell {
    width: 400px; max-width: 400px; height: min(820px, calc(100vh - 96px)); min-height: 0; margin: 24px auto 0;
    background: var(--bg); border: 10px solid var(--frame); border-radius: 46px; overflow-y: auto; overflow-x: hidden;
    box-shadow: 0 30px 70px rgba(43, 58, 49, 0.28); padding: 6px 18px 18px; scrollbar-width: none;
  }
  .shell::-webkit-scrollbar { display: none; }
  .top { position: sticky; top: -6px; background: var(--bg); z-index: 3; padding-top: 16px; }
  .frame-note { display: block; text-align: center; color: var(--text-muted); font-size: 0.8125rem; margin: 10px 0 0; }
}

.bubble a { color: var(--action); font-weight: 600; text-underline-offset: 3px; }

/* --- three areas: Talk, My support, Your choices ------------------------------ */
.dock { position: sticky; bottom: 0; z-index: 4; background: var(--bg); padding-top: 6px; margin-top: 12px; }
.dock .urgent-btn { position: static; margin-top: 0; box-shadow: 0 4px 14px rgba(191, 70, 70, 0.18); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; padding-bottom: 8px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; padding: 6px 4px; border: 0; border-radius: 14px; background: transparent; color: var(--text-muted); font-size: 0.8125rem; font-weight: 600; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--text); background: var(--surface); }
.concept { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; background: var(--notice); color: var(--notice-text); margin-bottom: 10px; }
.saved { position: relative; }
.saved .remove { margin-top: 8px; }
.chip.on { background: var(--surface); border-color: var(--action); }
.option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; margin-top: 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 1rem; font-weight: 500; text-align: left; }
.option[aria-checked="true"] { border: 2px solid var(--action); }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); display: grid; place-items: center; flex: none; }
.swatch i { width: 12px; height: 20px; border-radius: 6px; display: block; }
.swatch.sage { background: #F4EFE6; } .swatch.sage i { background: #354C3F; }
.swatch.peach { background: #F8EDE5; } .swatch.peach i { background: #8A3D4B; }
.swatch.evening { background: #252F2A; } .swatch.evening i { background: #DDE5D7; }
.option .radio { margin-left: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--text-muted); }
.option[aria-checked="true"] .radio { border-color: var(--action); background: radial-gradient(var(--action) 45%, transparent 50%); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 8px; }
.switch button { width: 52px; height: 30px; border-radius: 999px; border: 1px solid var(--text-muted); background: var(--surface); position: relative; flex: none; }
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 1px solid var(--text-muted); }
.switch button[aria-checked="true"] { background: var(--action); }
.switch button[aria-checked="true"]::after { left: 25px; }
/* the next few minutes */
.pause-art { height: 150px; border-radius: var(--radius-lg); background: var(--surface); display: grid; place-items: center; margin: 14px 0; overflow: hidden; }
.pause-art .orb { width: 70px; height: 70px; border-radius: 50%; background: var(--card); opacity: 0.85; }
.pause-line { font-family: var(--font-display); font-size: 1.375rem; min-height: 2.2em; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.offer .btn { width: 100%; margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="less"]) .pause-art.running .orb { animation: breathe 10s ease-in-out infinite; }
}
@keyframes breathe { 0%, 100% { transform: scale(0.7); } 40% { transform: scale(1.5); } 55% { transform: scale(1.5); } }
:root[data-motion="less"] * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

.plan-l { display: block; font-weight: 600; font-size: 0.875rem; margin: 12px 0 4px; }
.plan { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--text-muted); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.helped { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 0.875rem; color: var(--text-muted); }
.helped .chip { min-height: 36px; padding: 4px 14px; }
.offline { background: var(--notice); color: var(--notice-text); font-weight: 600; font-size: 0.875rem; text-align: center; padding: 6px 12px; }

/* message box lives in the dock while talking */
.dock .composer { margin: 0 0 8px; }
.thread > * { scroll-margin-bottom: 190px; }
.sending { scroll-margin-bottom: 190px; }
/* nothing peeks out under the dock */
.shell { padding-bottom: 0 !important; }
.tabs { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#urgent-request:not(:empty) + p.small.center { display: none; } /* the request card already carries the same fixed line */

/* tappable list of approved services under "Finding local support" */
.options-list { display: grid; gap: 6px; margin: 10px 0 4px; }
.opt { text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.9375rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.opt::after { content: "›"; color: var(--text-muted); font-size: 1.1rem; }
.opt:hover { border-color: var(--action); }
.opt.team { background: transparent; border-style: dashed; }
/* quieter controls under a reply: one small feedback row, one small link */
.helped { margin-top: 6px; font-size: 0.8125rem; }
.helped .chip { min-height: 32px; padding: 2px 12px; font-size: 0.8125rem; font-weight: 500; }
.why { margin-top: 2px; font-size: 0.8125rem; }
.why summary { min-height: 32px; font-weight: 500; text-decoration-color: var(--border); }
.bubble.me { scroll-margin-top: 96px; }
/* short screens: smaller picture so all three choices show above the dock */
@media (max-height: 780px) { #view-welcome .art { height: 96px; margin-bottom: 14px; } #view-welcome h1 { font-size: 1.5rem; } }
.why.report summary { color: var(--text-muted); }
.why.report .chips { margin: 4px 0 8px; }
.why.report .chip { min-height: 32px; font-size: 0.8125rem; padding: 2px 12px; }

/* automatic translation */
.tr { margin-top: 6px; }
.card .tr { color: var(--text); border-left: 2px solid var(--border); padding-left: 10px; }
.tr-note { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }
.tr-switch { background: none; border: 0; padding: 0; color: var(--action); text-decoration: underline; font-size: 0.75rem; cursor: pointer; }

.card.checkin { margin-bottom: 14px; }
.mood-row { display: grid; gap: 6px; margin-top: 8px; }
.mood { display: flex; align-items: center; gap: 8px; }
.mood .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); }
.mood.good .dot { background: #7FA285; } .mood.okay .dot { background: #E2B45A; } .mood.struggling .dot { background: var(--accent); }
.helped .chip.read { margin-left: auto; }
.link-btn.someone { display: block; margin: 12px auto 0; }
.cover-note.off { color: var(--text); border-left: 2px solid var(--urgent); padding-left: 8px; }
.handover { margin-top: 10px; }
.handover textarea { margin-bottom: 4px; }

.composer .mic { min-width: 48px; padding: 0 12px; background: var(--card); color: var(--text); border: 1px solid var(--border); }
.composer .mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; vertical-align: middle; }
.composer .mic.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* one message: reply, then at most one small action, inside the same bubble */
.inline-offer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.inline-offer .status-text { font-weight: 500; }
.inline-offer .pause-actions { margin-top: 10px; }
.inline-offer .btn { min-height: 40px; font-size: 0.9rem; }
.bubble-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.bubble .sources { font-size: 0.8125rem; color: var(--text-muted); margin-top: 8px; }
.bubble:has(.inline-offer) { max-width: 94%; }
.inline-offer .pause-actions { display: flex; flex-wrap: wrap; }
.inline-offer .pause-actions .btn { flex: 1 1 auto; white-space: nowrap; padding: 0 16px; }

.share-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 0.875rem; color: var(--text-muted); }
.share-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent, #354C3F); flex: none; }

/* Urgent help: always there, never shouting. A calm outlined bar; the urgent screen itself stays clear and direct. */
.urgent-btn { background: var(--card, #FFFCF7); color: var(--urgent); border: 1.5px solid color-mix(in srgb, var(--urgent) 55%, transparent); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), 0 0 0 4px var(--bg); font-weight: 600; min-height: 48px; }
.urgent-btn::before { background: var(--urgent); opacity: 1; }
.urgent-btn:hover { filter: none; background: color-mix(in srgb, var(--urgent) 7%, var(--card, #FFFCF7)); }
.dock .urgent-btn { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }

/* Back to the start: always one tap, top left of the quick exit */
.top-actions { display: flex; align-items: center; gap: 8px; }
.start-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border, #E3DDD2); background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.start-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.start-btn[hidden] { display: none; }
/* A tapped starting choice: a quiet label, not a message from the person */
.chose { align-self: center; text-align: center; margin: 14px auto 2px; font-size: 0.8125rem; color: var(--text-muted); background: color-mix(in srgb, var(--surface) 55%, transparent); padding: 4px 12px; border-radius: 999px; width: fit-content; }

.start-btn { min-height: 40px; padding: 0 14px 0 8px; margin: 2px 0 4px; background: transparent; border-color: var(--border, #E3DDD2); font-size: 0.9375rem; }
.start-btn svg { width: 18px; height: 18px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Softer corners, less pill-like (Jamie, 17 Nov) */
.btn, .chip, .urgent-btn, .quick-exit, .start-btn, .composer input, .composer button, .opt, .option { border-radius: 12px; }
.choice { border-radius: 14px; }
.action-note { margin: 8px 0 0; font-size: 0.875rem; color: var(--text-muted); line-height: 1.4; }
.install-steps { margin: 10px 0 0; padding-left: 20px; } .install-steps li { margin: 4px 0; }
/* Dropdowns: our own arrow, set well in from the edge */
select { -webkit-appearance: none; appearance: none; padding-right: 44px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23596359' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important; background-position: right 16px center !important; background-size: 14px !important; cursor: pointer; }
/* More room between the message box, urgent help and the tabs, so nothing is tapped by accident */
.dock .composer { margin: 0 0 18px; }
.dock .urgent-btn { margin-bottom: 0; }
.tabs { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
/* While typing, the tabs step aside (urgent help stays) */
body.typing .tabs { display: none; }
.inline-offer.follow { margin-top: 10px; padding-top: 0; border-top: 0; }
