/* Burrow for Two. Layout idea: one phone-width column, a den scene up top, a tab bar at the bottom. */
:root{
  --bg:#FCEFEA; --surface:#FFFAF7; --surface2:#F7E1DA; --ink:#33172F; --muted:#7F5F78; --line:#EBCFC8;
  --accent:#E23D6D; --accent-ink:#FFFFFF; --sun:#F6B93B;
  --ok:#2E9E6B; --bad:#C93B3B; --paper:#FFFDF8;
  --font-display:'Bagel Fat One','Arial Rounded MT Bold','Trebuchet MS',sans-serif;
  --font-body:'Onest',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --r:18px; --bubble-r:20px; --fs:16px;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --bg:#1B1530; --surface:#271F42; --surface2:#33294F; --ink:#F7EEFF; --muted:#B5A6CF; --line:#3D3260;
    --accent:#FF7B9C; --accent-ink:#2A0F1E; --sun:#FFD166; --ok:#5CD6A0; --bad:#FF8A8A;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#1B1530; --surface:#271F42; --surface2:#33294F; --ink:#F7EEFF; --muted:#B5A6CF; --line:#3D3260;
  --accent:#FF7B9C; --accent-ink:#2A0F1E; --sun:#FFD166; --ok:#5CD6A0; --bad:#FF8A8A;
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--font-body);font-size:var(--fs);line-height:1.45;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
:focus-visible{outline:3px solid var(--sun);outline-offset:2px;border-radius:8px}
h1,h2,h3{font-family:var(--font-display);font-weight:400;margin:0;text-wrap:balance;letter-spacing:.2px}
h1{font-size:2.5rem;line-height:1.02} h2{font-size:1.35rem} h3{font-size:1.05rem}
p{margin:0}
.muted{color:var(--muted)} .small{font-size:.84rem} .center{text-align:center}
.row{display:flex;gap:10px;align-items:center} .row.wrap{flex-wrap:wrap} .col{display:flex;flex-direction:column;gap:12px}
.grow{flex:1;min-width:0} .between{justify-content:space-between}

#app{height:100%;max-width:560px;margin:0 auto;display:flex;flex-direction:column;position:relative}
.page{flex:1;overflow-y:auto;padding:22px 18px 40px;display:flex;flex-direction:column;gap:18px}
.wordmark{font-family:var(--font-display);font-size:1.5rem;color:var(--accent);line-height:1}
.wordmark i{font-style:normal;color:var(--sun)}

.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;display:flex;flex-direction:column;gap:12px}
.card.tint{background:var(--surface2);border-color:transparent}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;background:var(--accent);color:var(--accent-ink);font-weight:700;padding:11px 18px;border-radius:999px;min-height:44px;transition:transform .12s}
.btn:active{transform:scale(.97)}
.btn.ghost{background:transparent;color:var(--ink);border:1.5px solid var(--line)}
.btn.soft{background:var(--surface2);color:var(--ink)}
.btn.danger{background:transparent;color:var(--bad);border:1.5px solid var(--bad)}
.btn.sm{padding:6px 12px;min-height:34px;font-size:.88rem}
.btn[disabled]{opacity:.45;cursor:not-allowed}
.link{color:var(--accent);font-weight:600;text-decoration:underline;text-underline-offset:3px}
.field{display:flex;flex-direction:column;gap:5px}
.field>span{font-size:.82rem;font-weight:600;color:var(--muted)}
input[type=text],input[type=number],input[type=date],input[type=password],select,textarea{
  background:var(--surface);border:1.5px solid var(--line);border-radius:12px;padding:10px 12px;width:100%;min-height:44px}
textarea{resize:vertical;min-height:70px}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--accent)}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chips.scroll{flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:thin}
.chip{flex:none;display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border-radius:999px;background:var(--surface);border:1.5px solid var(--line);font-size:.9rem;font-weight:600;min-height:38px}
.chip[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.seg{display:flex;background:var(--surface2);border-radius:999px;padding:4px;gap:2px;overflow-x:auto}
.seg button{flex:1;white-space:nowrap;padding:8px 12px;border-radius:999px;font-weight:700;font-size:.88rem;color:var(--muted)}
.seg button[aria-pressed=true]{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.toggle{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:6px 0}
.toggle input{appearance:none;width:46px;height:28px;border-radius:99px;background:var(--line);position:relative;flex:none;cursor:pointer;transition:background .15s;min-height:0;padding:0;border:0}
.toggle input::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:var(--surface);transition:transform .15s}
.toggle input:checked{background:var(--accent)} .toggle input:checked::after{transform:translateX(18px)}
.badge{display:inline-flex;align-items:center;gap:6px;background:var(--sun);color:#3A2500;font-weight:700;border-radius:99px;padding:3px 10px;font-size:.82rem}
.animal{display:block;flex:none}

/* boot, splash */
.full{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:28px;text-align:center}
.splash{background:radial-gradient(120% 80% at 50% 20%,var(--tint,var(--surface2)) 0%,var(--bg) 70%)}
.splash .animal{animation:bob 2.4s ease-in-out infinite}
.splash blockquote{margin:0;font-size:1.1rem;max-width:30ch}
.bar{width:160px;height:6px;border-radius:9px;background:var(--line);overflow:hidden}
.bar i{display:block;height:100%;width:40%;background:var(--accent);border-radius:9px;animation:slide 1.3s ease-in-out infinite}
@keyframes slide{0%{transform:translateX(-100%)}100%{transform:translateX(260%)}}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@keyframes shake{20%,60%{transform:translateX(-8px)}40%,80%{transform:translateX(8px)}}

/* onboarding */
.hero{display:flex;gap:14px;align-items:flex-end}
.hero h1{color:var(--accent)} .hero h1 i{font-style:normal;color:var(--sun)}
.zoo{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.zoo button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 6px;border-radius:16px;background:var(--surface);border:2px solid var(--line);text-align:center}
.zoo button b{font-size:.92rem} .zoo button span{font-size:.72rem;color:var(--muted);line-height:1.25}
.zoo button[aria-pressed=true]{border-color:var(--accent);background:var(--surface2)}
.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.code{font-family:var(--font-display);font-size:1.9rem;letter-spacing:2px;color:var(--accent);user-select:all}

/* lock */
.dots{display:flex;gap:14px} .dots i{width:16px;height:16px;border-radius:50%;border:2px solid var(--ink)} .dots i.on{background:var(--ink)}
.dots.bad{animation:shake .4s}
.pad{display:grid;grid-template-columns:repeat(3,72px);gap:12px}
.pad button{height:64px;border-radius:50%;background:var(--surface);border:1.5px solid var(--line);font-size:1.4rem;font-weight:700}

/* shell */
.hdr{display:flex;align-items:center;gap:10px;padding:12px 18px 8px}
.presence{display:inline-flex;align-items:center;gap:6px;font-size:.8rem;font-weight:600;color:var(--muted)}
.presence i{width:9px;height:9px;border-radius:50%;background:var(--line)} .presence.on i{background:var(--ok)}
.iconbtn{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;background:var(--surface);border:1px solid var(--line)}
#main{flex:1;overflow-y:auto;padding:8px 18px 20px;display:flex;flex-direction:column;gap:16px}
#main.flush{padding:0;overflow:hidden}
.nav{display:flex;background:var(--surface);border-top:1px solid var(--line);padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px))}
.nav button{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 0;border-radius:14px;font-size:.72rem;font-weight:700;color:var(--muted);position:relative}
.nav button[aria-current=page]{color:var(--accent);background:var(--surface2)}
.nav svg{width:24px;height:24px}
.nav .dot{position:absolute;top:4px;right:calc(50% - 18px);min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--accent);color:var(--accent-ink);font-size:.68rem;display:grid;place-items:center}
.banner{background:var(--sun);color:#3A2500;font-size:.82rem;font-weight:600;padding:6px 18px;text-align:center}

[hidden]{display:none!important}
/* den */
.den{position:relative;border-radius:26px;padding:18px 12px 14px;background:linear-gradient(180deg,var(--surface2),var(--surface));border:1px solid var(--line);display:grid;grid-template-columns:1fr auto 1fr;align-items:end;gap:4px;overflow:hidden}
.den::after{content:"";position:absolute;left:-10%;right:-10%;bottom:-46px;height:90px;border-radius:50%;background:var(--bg);opacity:.7}
.den>*{position:relative;z-index:1}
.who{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center;min-width:0}
.who b{font-size:1.02rem;overflow-wrap:anywhere}
.who .mood{font-size:.8rem;font-weight:700;padding:3px 10px;border-radius:99px;background:var(--tint,var(--surface));color:#2B1B2B}
.who .act{font-size:.78rem;color:var(--muted)}
.who q{font-size:.82rem;color:var(--muted);quotes:"\201C" "\201D";overflow-wrap:anywhere}
.heart{align-self:center;display:flex;flex-direction:column;align-items:center;font-family:var(--font-display);color:var(--accent);line-height:1}
.heart b{font-size:1.7rem;font-weight:400} .heart span{font-family:var(--font-body);font-size:.68rem;color:var(--muted);font-weight:700}
.moodgrid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.moodgrid button{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 2px;border-radius:14px;border:2px solid transparent;background:var(--surface2);font-size:.72rem;font-weight:700}
.moodgrid button[aria-pressed=true]{border-color:var(--accent);background:var(--surface)}
.nudges{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.nudges button{display:flex;flex-direction:column;align-items:center;gap:2px;background:var(--surface2);border-radius:16px;padding:10px 4px;font-size:.74rem;font-weight:700}
.nudges button span{font-size:1.6rem;line-height:1.1}
.answer{background:var(--surface2);border-radius:14px;padding:10px 12px}
.answer b{font-size:.78rem;color:var(--muted);display:block}

/* chat */
.chat{flex:1;display:flex;flex-direction:column;min-height:0}
.msgs{flex:1;overflow-y:auto;padding:12px 16px;display:flex;flex-direction:column;gap:6px}
.msgs.dots{background-image:radial-gradient(var(--line) 1.2px,transparent 1.3px);background-size:18px 18px}
.msgs.stripes{background-image:repeating-linear-gradient(135deg,transparent 0 14px,var(--surface2) 14px 16px)}
.msgs.hearts{background-image:radial-gradient(circle at 6px 6px,var(--surface2) 5px,transparent 5.5px),radial-gradient(circle at 14px 6px,var(--surface2) 5px,transparent 5.5px);background-size:44px 44px}
.day{align-self:center;font-size:.72rem;font-weight:700;color:var(--muted);background:var(--surface);padding:3px 10px;border-radius:9px;margin:6px 0}
.msg{max-width:80%;display:flex;flex-direction:column;gap:2px;align-self:flex-start}
.msg.me{align-self:flex-end;align-items:flex-end}
.bubble{background:var(--surface);border:1px solid var(--line);padding:9px 13px;border-radius:var(--bubble-r);border-bottom-left-radius:6px;overflow-wrap:anywhere;white-space:pre-wrap;text-align:left;position:relative}
.msg.me .bubble{background:var(--accent);color:var(--accent-ink);border-color:transparent;border-radius:var(--bubble-r);border-bottom-right-radius:6px}
.bubble.plain{background:none!important;border:0;padding:0}
.bubble img{display:block;max-width:100%;max-height:300px;border-radius:14px}
.bubble.once{border:2px dashed var(--sun);background:var(--surface);color:var(--ink);font-weight:700}
.bubble .rx{position:absolute;bottom:-12px;right:8px;background:var(--surface);border:1px solid var(--line);border-radius:99px;padding:0 6px;font-size:.85rem;color:var(--ink)}
.meta{font-size:.68rem;color:var(--muted);padding:0 6px}
.msg.hasrx{margin-bottom:10px}
.typing{font-size:.78rem;color:var(--muted);padding:0 18px;min-height:20px}
.composer{display:flex;gap:6px;align-items:flex-end;padding:8px 10px;background:var(--surface);border-top:1px solid var(--line)}
.composer textarea{min-height:44px;max-height:120px;resize:none;border-radius:22px}
.composer .iconbtn{flex:none;background:var(--surface2);border:0}
.composer .iconbtn[aria-pressed=true]{background:var(--sun);color:#3A2500}
.composer .send{background:var(--accent);color:var(--accent-ink)}
.emo{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;padding:8px 10px;background:var(--surface);border-top:1px solid var(--line);max-height:170px;overflow-y:auto}
.emo button{font-size:1.45rem;padding:4px;border-radius:10px}
.emo button:hover{background:var(--surface2)}

/* play */
.house{display:grid;grid-template-columns:repeat(6,1fr);gap:3px;padding:10px;border-radius:22px;background:var(--wall,var(--surface2));border:1px solid var(--line)}
.tile{aspect-ratio:1;border-radius:10px;background:color-mix(in srgb,var(--surface) 70%,transparent);display:grid;place-items:center;font-size:clamp(1.2rem,6vw,1.9rem);position:relative}
.tile .animal{width:92%;height:auto}
.tile .say{position:absolute;top:-8px;right:-4px;font-size:.9rem;background:var(--surface);border:1px solid var(--line);border-radius:99px;padding:0 4px;z-index:2}
.tile.mine{outline:2px solid var(--accent)}
.swatch{width:30px;height:30px;border-radius:50%;border:2px solid var(--line);flex:none}
.swatch[aria-pressed=true]{outline:3px solid var(--accent);outline-offset:2px}
.pet{font-size:5.2rem;line-height:1;animation:bob 2s ease-in-out infinite}
.meter{display:grid;grid-template-columns:70px 1fr 38px;gap:8px;align-items:center;font-size:.84rem;font-weight:600}
.meter div{height:10px;border-radius:9px;background:var(--surface2);overflow:hidden}
.meter i{display:block;height:100%;border-radius:9px;background:var(--ok)} .meter i.low{background:var(--bad)}
.ttt{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:300px;margin:0 auto;width:100%}
.ttt button{aspect-ratio:1;border-radius:18px;background:var(--surface2);display:grid;place-items:center;padding:8px}
.ttt button .animal{width:100%;height:auto}
.rps{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.rps button{background:var(--surface2);border-radius:18px;padding:14px 6px;font-size:2.2rem;display:flex;flex-direction:column;align-items:center;gap:4px;border:2px solid transparent}
.rps button small{font-size:.76rem;font-weight:700}
.rps button[aria-pressed=true]{border-color:var(--accent)}
.idea{font-family:var(--font-display);font-size:1.4rem;text-align:center;padding:20px 10px;color:var(--accent);text-wrap:balance}

/* create */
.canvaswrap{border-radius:18px;overflow:hidden;border:1px solid var(--line);background:var(--paper);touch-action:none}
canvas{display:block;width:100%;aspect-ratio:1;touch-action:none;cursor:crosshair}
.notes{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.note{border-radius:6px 6px 18px 6px;padding:10px;display:flex;flex-direction:column;gap:6px;color:#2E2430;box-shadow:0 2px 0 rgba(0,0,0,.08)}
.note textarea{background:transparent;border:0;padding:0;min-height:96px;color:inherit;border-radius:0}
.note .small{color:#5c4d5e}
.list{display:flex;flex-direction:column}
.item{display:flex;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.item:last-child{border-bottom:0}
.item input[type=checkbox]{width:22px;height:22px;accent-color:var(--accent);flex:none}
.item.done span{text-decoration:line-through;color:var(--muted)}
.x{color:var(--muted);font-size:1.2rem;width:32px;height:32px;border-radius:50%;flex:none}
.count{font-family:var(--font-display);color:var(--accent);font-size:1.1rem;white-space:nowrap}

/* overlay */
.scrim{position:fixed;inset:0;background:rgba(15,8,20,.55);z-index:40}
.sheet{position:fixed;left:50%;bottom:0;transform:translateX(-50%);width:min(560px,100%);max-height:88%;overflow-y:auto;background:var(--bg);border-radius:24px 24px 0 0;padding:20px 18px 26px;z-index:41;display:flex;flex-direction:column;gap:14px}
.sheet img.big{max-width:100%;border-radius:14px;align-self:center}
#toasts{position:fixed;left:0;right:0;top:14px;display:flex;flex-direction:column;align-items:center;gap:8px;z-index:60;pointer-events:none}
.toast{background:var(--ink);color:var(--bg);padding:9px 16px;border-radius:99px;font-weight:600;font-size:.9rem;max-width:90%;box-shadow:0 6px 20px rgba(0,0,0,.25)}
#fx{position:fixed;inset:0;pointer-events:none;z-index:55;overflow:hidden}
#fx span{position:absolute;bottom:-60px;font-size:2.2rem;animation:rise 2.4s ease-out forwards}
@keyframes rise{to{transform:translateY(-110vh) rotate(25deg);opacity:0}}
/* whatsapp */
.wabar{display:flex;gap:8px;align-items:center;padding:8px 12px;background:var(--surface);border-bottom:1px solid var(--line)}
.msgs.wa{max-height:62vh;min-height:200px;border-radius:14px;background:var(--surface2);flex:none}
.stat{display:flex;flex-direction:column;gap:3px;padding:6px 0;border-bottom:1px solid var(--line)}
.stat:last-of-type{border-bottom:0}
.sv{min-width:72px;font-variant-numeric:tabular-nums;font-weight:600} .sv.r{text-align:right}
.split{flex:1;height:8px;border-radius:9px;background:var(--sun);overflow:hidden} .split i{display:block;height:100%;background:var(--accent)}
/* sage */
.sagehead{display:flex;gap:10px;align-items:center;padding:10px 14px 8px}
.sagetop{margin:-8px -18px 0} .sagetop .sagehead{padding:4px 18px 8px} .sagetop>div:last-child{padding:0 18px!important}
.sagenote{margin:8px 14px 0;padding:8px 12px;border-radius:12px;background:var(--surface2);color:var(--muted)}
.sagebar{padding:6px 12px;gap:8px;border-top:1px solid var(--line);background:var(--surface)} .sagebar .seg{flex:1} .sagebar .seg button{padding:6px 8px;font-size:.8rem}
.msg.sage{max-width:92%}
.bubble.md{white-space:normal} .bubble.md p,.report p{margin:0 0 .5em} .bubble.md p:last-child{margin-bottom:0}
.bubble.md ul,.report ul{margin:.2em 0 .5em;padding-left:1.2em} .bubble.md li,.report li{margin:.15em 0}
.bubble.md h4,.report h4{margin:.6em 0 .3em;font-size:1rem;font-family:var(--font-display);font-weight:400;color:var(--accent)}
.report{background:var(--surface2);border-radius:14px;padding:12px 14px;line-height:1.55}
.sageempty{display:flex;flex-direction:column;align-items:center;gap:12px;padding:20px 8px;margin:auto 0}
.sageempty p{max-width:34ch}
.attmap{width:100%;max-width:300px;align-self:center;color:var(--ink)}
.pill{display:inline-block;padding:3px 10px;border-radius:99px;font-weight:700;font-size:.82rem;color:var(--ink);background:color-mix(in srgb,var(--c) 22%,transparent);border:1.5px solid var(--c)}
.qitem{display:flex;flex-direction:column;gap:6px;padding:10px 0;border-bottom:1px solid var(--line)}
.likert{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
.likert button{min-height:42px;border-radius:12px;background:var(--surface);border:1.5px solid var(--line);font-weight:700}
.likert button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.moodrow{display:grid;grid-template-columns:64px 1fr;gap:8px;align-items:center}
.strip{display:grid;grid-template-columns:repeat(30,1fr);gap:2px} .strip i{aspect-ratio:1;border-radius:3px;display:block}
.nav button span{font-size:.68rem}
@media (max-width:380px){.zoo{grid-template-columns:repeat(2,1fr)} .two{grid-template-columns:1fr} h1{font-size:2.1rem}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
.sageempty .chip{flex:0 1 auto;max-width:100%;white-space:normal;text-align:center;justify-content:center;line-height:1.3}
.wabar .btn{flex:none}

/* cloud sign-in */
#auth{position:fixed;inset:0;z-index:70;background:var(--bg);display:flex;align-items:center;justify-content:center;padding:24px 18px;overflow-y:auto}
.authcard{width:min(420px,100%);display:flex;flex-direction:column;gap:14px;text-align:center}
.authcard .field{text-align:left} .authcard .link{align-self:center}
.aerr{color:var(--bad);min-height:1.2em;margin:0}
