/* Standalone reset (the website has no host page around it) */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
/* Layout: one calm phone-width column, task first, with a fixed tab bar. Teal brand, urgency colours that differ in lightness. */
:root {
  color-scheme: light;
  --bg: #F5F6F3; --surface: #FFFFFF; --surface-2: #EEF1EF; --line: #DDE2DE; --line-strong: #C3CBC7;
  --fg: #13201C; --muted: #4A5752;
  --brand: #0E6B5C; --brand-hover: #0A574A; --on-brand: #FFFFFF; --brand-soft: #E3F0EC; --brand-ink: #0B5C4F;
  --l1: #0B5C4F; --l1-soft: #E3F0EC; --l1-bar: #8FCBBC;
  --l2: #1D5BA8; --l2-soft: #E4EDF8; --l2-bar: #1D5BA8;
  --l3: #8F4500; --l3-soft: #FBEBDC; --l3-bar: #D98A3D;
  --l4: #B42318; --l4-soft: #FCE8E6; --l4-bar: #B42318;
  --danger: #B42318; --on-danger: #FFFFFF; --danger-tint: #FFE4E0;
  --focus: #1D5BA8;
  --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1513; --surface: #18201D; --surface-2: #212A27; --line: #2C3632; --line-strong: #44504B;
  --fg: #E8EEEB; --muted: #A7B3AE;
  --brand: #4CC3A8; --brand-hover: #6BD3BB; --on-brand: #062A23; --brand-soft: #173A33; --brand-ink: #7FD6C2;
  --l1: #7FD6C2; --l1-soft: #173A33; --l1-bar: #3E8F7E;
  --l2: #8DB8F0; --l2-soft: #1A2B44; --l2-bar: #6FA2E6;
  --l3: #F2B577; --l3-soft: #3A2716; --l3-bar: #D98A3D;
  --l4: #FF9C92; --l4-soft: #3E1C19; --l4-bar: #E0574B;
  --danger: #C4362B; --on-danger: #FFFFFF; --danger-tint: #FFE4E0;
  --focus: #8DB8F0; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0F1513; --surface: #18201D; --surface-2: #212A27; --line: #2C3632; --line-strong: #44504B;
  --fg: #E8EEEB; --muted: #A7B3AE;
  --brand: #4CC3A8; --brand-hover: #6BD3BB; --on-brand: #062A23; --brand-soft: #173A33; --brand-ink: #7FD6C2;
  --l1: #7FD6C2; --l1-soft: #173A33; --l1-bar: #3E8F7E;
  --l2: #8DB8F0; --l2-soft: #1A2B44; --l2-bar: #6FA2E6;
  --l3: #F2B577; --l3-soft: #3A2716; --l3-bar: #D98A3D;
  --l4: #FF9C92; --l4-soft: #3E1C19; --l4-bar: #E0574B;
  --danger: #C4362B; --on-danger: #FFFFFF; --danger-tint: #FFE4E0;
  --focus: #8DB8F0; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.app { max-width: 560px; margin: 0 auto; padding-block: 16px 112px; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.xs { font-size: .8rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 26px; height: 26px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--brand-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--r-md);
  border: 1.5px solid transparent; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-outline { background: var(--surface); color: var(--brand-ink); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--brand-ink); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.06rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: none; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--fg); }
.icon-btn:hover { background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; }
.li-btn { width: 100%; background: none; border: none; text-align: left; cursor: pointer; }
.li-btn:hover { background: var(--surface-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-size: .78rem; font-weight: 700; }
.tile { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; }

.topbar { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; letter-spacing: -.2px; }
.chip-loc { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .95rem; max-width: 100%; }
.chip-loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero { background: var(--brand); color: var(--on-brand); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.hero h1 { font-size: 1.6rem; }
.hero p { opacity: .92; }
.hero .btn { background: var(--on-brand); color: var(--brand); margin-top: 8px; }
.hero .btn:hover { opacity: .94; }

.sos { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 18px; background: var(--l4-soft); border: 1px solid var(--line); }
.sos-num { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qa { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.qa:hover { border-color: var(--line-strong); }

/* Symptom check */
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); border-radius: 3px; transition: width .25s ease; }
.seg { display: grid; gap: 8px; }
.seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 700; cursor: pointer; text-align: center; }
.opt[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.opt-tall { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.opt-tall .xs { font-weight: 400; }
.opt[aria-pressed="true"] .xs { color: inherit; opacity: .9; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .95rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.search { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 1rem; }
.selected-main { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border: 2px solid var(--brand); border-radius: var(--r-md); background: var(--brand-soft); }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.scroll-x .chip { flex-shrink: 0; }
.symlist { max-height: 340px; overflow-y: auto; }
.qcard { display: flex; flex-direction: column; gap: 10px; }
.footer-actions { display: flex; gap: 10px; }
.footer-actions .btn { flex: 1; }
textarea { width: 100%; min-height: 96px; padding: 12px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong); background: var(--surface); resize: vertical; }
details.ai summary { cursor: pointer; font-weight: 700; color: var(--brand-ink); min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
details.ai summary::-webkit-details-marker { display: none; }

/* Result */
.triage { border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); }
.triage .ic { width: 48px; height: 48px; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--surface); }
.scale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; align-items: end; }
.scale > div { height: 6px; border-radius: 3px; opacity: .45; }
.scale > div.on { height: 12px; opacity: 1; }
.scale-l { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; font-size: .75rem; color: var(--muted); }
.scale-l .on { color: var(--fg); font-weight: 800; }
.bars { display: inline-flex; gap: 3px; }
.bars span { width: 8px; height: 14px; border-radius: 2px; background: var(--line-strong); }
.bars span.on { background: var(--brand); }
.cond summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; cursor: pointer; list-style: none; }
.cond summary::-webkit-details-marker { display: none; }
.cond summary .chev { transition: transform .2s ease; }
.cond[open] summary .chev { transform: rotate(90deg); }
.cond .body { padding: 0 14px 14px 14px; display: flex; flex-direction: column; gap: 8px; font-size: .95rem; }
.cond .body b { font-weight: 700; }
.warn { background: var(--l3-soft); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); }
ul.tight { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

.em { background: var(--danger); color: var(--on-danger); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.em .big { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 68px; border-radius: 18px; background: #FFFFFF; color: #B42318; font-size: 1.5rem; font-weight: 800; text-decoration: none; }
.em .soft { color: var(--danger-tint); }
.em .outline { border: 2px solid #FFFFFF; background: transparent; color: #FFFFFF; }

.num { font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.bignum { font-size: 3.2rem; line-height: 1; font-weight: 800; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20;
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.nav-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; text-decoration: none; font-size: .75rem; font-weight: 600; color: var(--muted); }
.nav a .pill { display: inline-flex; padding: 3px 16px; border-radius: 14px; }
.nav a[aria-current="page"] { color: var(--brand-ink); font-weight: 800; }
.nav a[aria-current="page"] .pill { background: var(--brand-soft); }

dialog { border: none; border-radius: var(--r-lg); padding: 0; width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgba(10, 20, 17, .55); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .95rem; }
.field { min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 400; width: 100%; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 40; max-width: calc(100vw - 32px); }
.plan { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.plan[aria-pressed="true"] { border: 2px solid var(--brand); }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.plan[aria-pressed="true"] .radio { border-color: var(--brand); }
.plan[aria-pressed="true"] .radio::after { content: ""; width: 10px; height: 10px; border-radius: 5px; background: var(--brand); }
.lock { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 720px) { .app { padding-top: 32px; } }

/* Mobile refinements */
.app { padding-top: max(16px, env(safe-area-inset-top, 0px)); }
.contact3 .btn { padding: 0 6px; font-size: .92rem; gap: 4px; min-width: 0; }
.li .btn { padding: 0 14px; }
.li .grow { overflow-wrap: anywhere; }
.chip, .opt, .btn { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea { touch-action: manipulation; }
@media (max-width: 360px) {
  h1 { font-size: 1.45rem; }
  .hero { padding: 18px; }
  .li { gap: 10px; padding: 10px 12px; }
  .li .tile { width: 34px; height: 34px; }
  .bignum { font-size: 2.6rem; }
  .card { padding: 14px; }
}
