:root{--navy:#00163B;--panel:#0B2554;--panel2:#12326B;--amber:#F59E2B;--gold:#FFD27A;--cream:#FFF3DC;--ember:#FF7A3C;--mute:#C9D3E6;--line:#2A4A86}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:radial-gradient(1200px 600px at 50% -10%,#0E2F6B 0%,var(--navy) 60%) fixed;color:var(--cream);font:18px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;min-height:100vh;display:flex;flex-direction:column}
a{color:var(--gold)}
button,input{font:inherit;color:inherit}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.skip{position:absolute;left:-999px;top:0;background:var(--gold);color:var(--navy);padding:10px;z-index:99}.skip:focus{left:8px;top:8px}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.top{display:flex;align-items:center;gap:8px;padding:10px 12px;padding-top:max(10px,env(safe-area-inset-top));position:sticky;top:0;z-index:20;background:rgba(0,22,59,.92);backdrop-filter:blur(6px);border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--cream);font-weight:700;font-size:16px;min-height:48px;min-width:0;flex:1}
.brand img{border-radius:8px;flex:none}.brand span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.meter{display:flex;flex-direction:column;align-items:flex-start;font-size:11px;color:var(--mute);width:56px;flex:none}
.mbar{display:block;width:100%;height:6px;background:var(--panel2);border-radius:6px;overflow:hidden}.mbar span{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--amber),var(--gold));transition:width 1.2s ease}
.tools{display:flex;gap:2px;flex:none}
.tool{width:48px;height:48px;border-radius:14px;border:0;background:transparent;font-size:20px;cursor:pointer}
.tool:hover{background:var(--panel)}
.tool[aria-pressed=true]{background:var(--panel2)}
main{flex:1;width:100%;max-width:640px;margin:0 auto;padding:12px 16px 24px}
.screen[hidden],[hidden]{display:none!important}
.hero{text-align:center;padding:4px 0 8px}
.guide-big{width:170px;height:190px;margin:0 auto}.guide-big.small{width:110px;height:124px}
.guide-sm{width:56px;height:62px;flex:none}
.guide-big svg,.guide-sm svg{width:100%;height:100%;display:block}
h1{font-size:32px;line-height:1.15;margin:6px 0 6px;color:var(--gold);font-weight:800;letter-spacing:.2px}
.h2{font-size:18px;color:var(--gold);margin:22px 0 10px}
.sub{color:var(--mute);margin:0 auto 14px;max-width:30em;font-size:17px}
.homeform,.typebox{display:flex;gap:8px;align-items:center;background:var(--panel);border:2px solid var(--line);border-radius:30px;padding:4px 4px 4px 16px}
.homeform:focus-within,.typebox:focus-within{border-color:var(--gold)}
.homeform input,.typebox input{flex:1;min-width:0;background:transparent;border:0;outline:0;color:var(--cream);font-size:18px;min-height:48px}
input::placeholder{color:#9FB0CF}
.send{width:48px;height:48px;border-radius:50%;border:0;background:var(--amber);color:var(--navy);font-size:20px;font-weight:800;cursor:pointer;flex:none}
.pills{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:12px 0}
.pill{min-height:48px;padding:8px 16px;border-radius:26px;border:1px solid var(--line);background:var(--panel);cursor:pointer;font-size:16px}
.pill:hover,.tile:hover,.row:hover,.chip:hover{background:var(--panel2)}
.tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.tile{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:92px;padding:12px;border-radius:18px;border:1px solid var(--line);background:var(--panel);cursor:pointer}
.tile-e{font-size:30px}.tile-t{font-weight:700;font-size:17px}
.rows{display:flex;flex-direction:column;gap:8px}
.row{display:flex;align-items:center;gap:12px;min-height:56px;padding:10px 14px;border-radius:16px;border:1px solid var(--line);background:var(--panel);cursor:pointer;text-align:left;width:100%}
.row-e{font-size:24px}.row-t{font-weight:600}
.back{min-height:48px;padding:6px 12px;border:0;background:transparent;color:var(--gold);cursor:pointer;font-size:16px;border-radius:12px}
.back:hover{background:var(--panel)}
.chat-top{display:flex;align-items:center;justify-content:space-between;gap:8px;position:sticky;top:68px;z-index:10;background:rgba(0,22,59,.9);padding:2px 0}
.note{font-size:14px;color:var(--mute);margin:2px 0 6px;text-align:center}
.log{display:flex;flex-direction:column;gap:12px;padding:8px 0 16px;outline:0;scroll-margin-bottom:200px}
.bubble{max-width:92%;padding:12px 16px;border-radius:20px;position:relative;word-wrap:break-word}
.bubble.y{background:var(--panel);border:1px solid var(--line);align-self:flex-start;border-top-left-radius:6px}
.bubble.p{background:var(--amber);color:var(--navy);align-self:flex-end;border-top-right-radius:6px;font-weight:600}
.btxt{font-size:19px}
.w{opacity:0}.w.on{opacity:1;transition:opacity .9s ease}
.calm .w.on,.calm .w{transition:none}
.replay{position:absolute;right:-6px;bottom:-14px;width:48px;height:48px;border-radius:50%;border:1px solid var(--line);background:var(--navy);cursor:pointer;font-size:18px;display:none}
.bubble.y.done .replay{display:inline-flex;align-items:center;justify-content:center;position:static;margin:6px 0 -6px;width:44px;height:44px}
.bubble.dots{display:flex;gap:6px;padding:16px 20px}.dots span{width:9px;height:9px;border-radius:50%;background:var(--gold);opacity:.35;animation:dt 1.6s ease-in-out infinite}.dots span:nth-child(2){animation-delay:.25s}.dots span:nth-child(3){animation-delay:.5s}
@keyframes dt{0%,100%{opacity:.25}50%{opacity:.9}}
.calm .dots span{animation:none;opacity:.6}
.ptag{margin-bottom:6px;font-size:13px;letter-spacing:.3px;color:var(--navy);display:inline-block}.ptag b{background:var(--gold);padding:3px 10px;border-radius:12px}.ptag i{color:var(--gold);margin-left:6px}
/* #log is a flex column with a definite height, so flex-shrink would crush an
   SVG-only scene to its 2px border. Lock the picture size and aspect. */
.log>*{flex-shrink:0}
.scene{align-self:center;flex:none;width:min(100%,288px);aspect-ratio:240/150;min-height:140px;max-height:180px;border-radius:20px;overflow:hidden;border:1px solid var(--line);background:var(--panel)}
.scene svg{display:block;width:100%;height:100%;aspect-ratio:240/150}
.dock{position:sticky;bottom:0;z-index:15;background:linear-gradient(180deg,rgba(0,22,59,0),var(--navy) 22%);padding:14px 0 max(8px,env(safe-area-inset-bottom));min-height:8px}
.dock-in{display:flex;flex-direction:column;gap:8px}
.chips{display:flex;flex-direction:column;gap:8px}
.chip{min-height:52px;padding:10px 16px;border-radius:26px;border:2px solid var(--amber);background:var(--panel);color:var(--cream);cursor:pointer;text-align:center;font-weight:600;font-size:17px}
.chip.quiet{border-color:var(--line);color:var(--mute);font-weight:500}
.chip.small{min-height:48px;font-size:16px;margin-top:10px}
.chip:disabled{opacity:.7;cursor:default;border-color:var(--line)}
.dock-row{display:flex;justify-content:center;gap:10px}
.link{min-height:48px;padding:6px 14px;background:none;border:0;color:var(--gold);cursor:pointer;text-decoration:underline;font-size:16px}
.breath{align-self:center;text-align:center;padding:8px 0}
.bring{position:relative;width:200px;height:200px;margin:0 auto;display:flex;align-items:center;justify-content:center}
.bcirc{position:absolute;inset:0;border-radius:50%;background:radial-gradient(circle,var(--gold),var(--amber) 55%,rgba(245,158,43,.15) 75%);transform:scale(.55);box-shadow:0 0 40px rgba(245,158,43,.35)}
.breath.still .bcirc{transition:none!important}
.btxt2{position:relative;font-weight:700;color:var(--navy);font-size:18px;max-width:120px}
.wcard{align-self:stretch;background:linear-gradient(160deg,#FFF3DC,#FFE2A8);color:#1b2a4a;border-radius:22px;padding:18px;border:2px solid var(--gold);box-shadow:0 8px 30px rgba(0,0,0,.35)}
.wcard .chip{background:var(--navy);color:var(--cream);width:100%}
.wc-top{display:flex;justify-content:space-between;align-items:center}.wc-tag{background:var(--navy);color:var(--gold);padding:4px 12px;border-radius:14px;font-size:13px;font-weight:700}
.wc-emoji{font-size:28px}.wc-line{font-size:20px;font-weight:700;margin:12px 0;line-height:1.35;color:#00163B}
.wc-sec{margin-top:10px}.wc-sec b{font-size:13px;text-transform:uppercase;letter-spacing:.6px;color:#8A4B00}.wc-sec p{margin:2px 0 0;font-size:17px}
.wc-foot{margin-top:12px;font-size:12px;color:#4a5878}
.albumitem{margin-bottom:18px}
.soft{align-self:stretch;background:rgba(11,37,84,.6);border:1px dashed var(--line);border-radius:18px;padding:14px 16px}
.soft h3{margin:0 0 4px;font-size:17px;color:var(--gold)}.soft p{margin:0 0 10px;color:var(--mute);font-size:16px}.soft small{color:var(--mute);display:block;margin-top:8px;font-size:13px}
.amts{display:flex;gap:8px;flex-wrap:wrap}.amt{min-width:64px;min-height:48px;display:inline-flex;align-items:center;justify-content:center;padding:6px 16px;border:2px solid var(--amber);border-radius:24px;text-decoration:none;color:var(--cream);font-weight:700}
.amt:hover{background:var(--panel2)}
.lk{display:flex;gap:12px;align-items:center;min-height:56px;padding:8px 4px;text-decoration:none;color:var(--cream);border-top:1px solid rgba(42,74,134,.5)}.lk small{color:var(--mute)}.lk-i{font-size:24px}
.prose p{margin:0 0 14px}.logo-credit{display:block;margin:0 auto 12px;border-radius:16px}
.crisis{color:#fff;padding:12px 0}.crisis h2{font-size:26px;line-height:1.25;margin:18px 0 12px;color:#fff}.big988{font-size:24px;font-weight:700;margin:18px 0}.big988 a{color:#fff}
.cbtn{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:8px 22px;margin:4px 6px 4px 0;border-radius:12px;background:#fff;color:#00163B;font-weight:800;text-decoration:none}
.quietbtn{min-height:48px;padding:8px 18px;background:transparent;border:1px solid #fff;border-radius:12px;color:#fff;cursor:pointer}
.err{color:#ffb4a0}
.thanks{position:fixed;left:12px;right:12px;bottom:16px;z-index:40;background:var(--panel);border:1px solid var(--gold);border-radius:18px;padding:14px 16px;max-width:560px;margin:0 auto;text-align:center}.thanks p{margin:0}
.overlay{position:fixed;inset:0;background:rgba(0,10,30,.8);z-index:50;display:flex;justify-content:center;align-items:flex-start;overflow:auto}
.sheet{width:100%;max-width:560px;background:var(--navy);min-height:100%;padding:12px 16px 32px;display:flex;flex-direction:column;gap:10px}
.foot{padding:14px 16px max(18px,env(safe-area-inset-bottom));text-align:center;border-top:1px solid var(--line);background:rgba(0,10,30,.5)}
.foot p{margin:4px 0}.f988{font-weight:700;font-size:16px}.fsmall{font-size:12.5px;color:var(--mute)}.fmore{font-size:14px}
body[data-screen=crisis]{background:#00163B}
body[data-screen=crisis] .tools,body[data-screen=crisis] .meter{display:none}
@media (max-width:360px){body{font-size:17px}h1{font-size:28px}.meter{display:none}.brand span{font-size:15px}.btxt{font-size:18px}}
@media (min-width:600px){.tiles{grid-template-columns:repeat(3,1fr)}.chips{flex-direction:row;flex-wrap:wrap}.chip{flex:1 1 45%}}
.calm *,.calm *::before,.calm *::after{animation-duration:0s!important;animation-iteration-count:1!important}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
/* sizing wins over avatar.css .av{width:100%} */
.guide-big.av{width:130px;height:146px;margin:0 auto}.guide-big.small.av{width:100px;height:112px}
.guide-sm.av{width:72px;height:80px;flex:none}
[tabindex="-1"]:focus{outline:none}
@media (max-width:420px){.brand span{display:none}.brand{flex:none}.meter{flex:1;width:auto;margin:0 6px}.tools{flex:none}}
h1{margin-top:8px}
.chat-top{background:var(--navy);top:68px;border-bottom:1px solid rgba(42,74,134,.5)}
.breath{padding-bottom:44px}.bring{display:block}
.btxt2{position:absolute;left:-20px;right:-20px;bottom:-44px;max-width:none;color:var(--cream);text-align:center}
@media (max-width:420px){.chat-top{top:68px}}
.guide-big.av{width:170px;height:170px}.guide-big.small.av{width:110px;height:110px}
.guide-sm.av{width:64px;height:64px}
.wc-top{gap:10px}.wc-av{width:44px;height:44px;border-radius:50%;border:2px solid var(--gold);flex:none}.wc-tag{margin-right:auto}

/* Chat uses a pinned column: the message list is the only scroller. */
html{height:100%;height:100dvh}
body{min-height:100%;min-height:100dvh}
body[data-screen=chat]{overflow:hidden;height:var(--app-h,100dvh);max-height:var(--app-h,100dvh)}
body[data-screen=chat] main{flex:1;min-height:0;display:flex;flex-direction:column;padding-bottom:8px}
body[data-screen=chat] #s-chat.screen{flex:1;min-height:0;display:flex;flex-direction:column}
.chat-top{position:relative;top:auto;flex-shrink:0}
.log{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;overflow-anchor:none;scroll-margin-bottom:0}
.dock{position:relative;flex-shrink:0;bottom:auto}
body[data-screen=chat] .foot{flex-shrink:0;padding:8px 16px max(8px,env(safe-area-inset-bottom))}
body[data-screen=chat] .foot .fsmall,body[data-screen=chat] .foot .fmore{display:none}
body.kb-open[data-screen=chat] .foot{display:none}
@media (max-width:420px){.chat-top{top:auto}}
/* pass 2 */
.badge{margin-left:auto;font-size:12px;padding:3px 9px;border-radius:12px;border:1px solid var(--line);color:var(--mute);white-space:nowrap;flex:none}
.badge.v{border-color:var(--gold);color:var(--gold)}
.chips.inline{flex-direction:row;flex-wrap:wrap;gap:8px}
.chips.inline .chip{flex:1 1 auto;min-height:48px;padding:8px 12px;font-size:16px}
.skipbtn{width:100%;min-height:56px;font-size:18px;position:relative;z-index:5}
.breath{padding-bottom:8px}
.bring{position:relative;width:170px;height:170px;margin:0 auto;pointer-events:none}
.btxt2{position:static;margin:10px auto 0;max-width:none;color:var(--cream);text-align:center;pointer-events:none}
.f988{white-space:nowrap;font-size:15px}.f988 .sms{text-decoration:none;margin-left:4px}
@media (max-width:360px){.f988{font-size:13.5px}.soft{padding:10px 12px}.soft p{display:none}.lk{min-height:48px;padding:4px}}
.dockq{margin:0 2px 8px;font-size:16px;line-height:1.35;color:var(--cream)}
/* pass 5: compact from measured available height / overlap, not fixed breakpoints */
.log{scroll-padding-top:16px}
body.hide-note #voiceNote{display:none}
/* pass 6: hide the text-talk note the whole time a wisdom card is in the chat, at every size */
#s-chat:has(.wcard) #voiceNote{display:none !important}
body.tight-chat .top{padding-top:max(6px,env(safe-area-inset-top));padding-bottom:6px}
body.tight-chat .guide-sm.av,body.tight-chat .guide-sm{width:44px;height:44px}
body.tight-chat .chat-top .back{min-height:40px;padding:4px 10px}
body.tight-chat .wcard{padding:10px 12px;margin-bottom:2px;position:relative}
body.tight-chat .wc-top{margin-bottom:2px;padding-right:112px;min-height:32px}
body.tight-chat .wc-av{display:none}
body.tight-chat .wc-line{font-size:17px;line-height:1.25;margin:4px 0}
body.tight-chat .wc-sec b{font-size:11px}
body.tight-chat .wc-sec p{font-size:15px;line-height:1.35;margin:2px 0 6px}
body.tight-chat .wcard .chip.small{position:absolute;top:6px;right:8px;margin:0;min-height:32px;padding:2px 10px;font-size:13px;width:auto}
body.tight-chat .wc-foot{display:none}
body.tight-chat .log{padding-bottom:6px}
body.tight-chat .wc-top .wc-emoji{display:none}
body.tight-chat .wc-tag{font-size:12px}
body.tight-chat .dockq{font-size:14.5px;line-height:1.3;margin-bottom:6px}
body.tight-chat .chips.inline .chip{min-height:44px}
body.tighter-chat .wc-sec p{font-size:14px;line-height:1.28;margin:1px 0 4px}
body.tighter-chat .wc-line{font-size:16px;margin:2px 0}
body.tighter-chat .wcard{padding:8px 12px}
body.tighter-chat .wcard .chip.small{min-height:32px;font-size:13px;padding:2px 10px}
