@font-face{font-family:Pixel;src:url(fonts/PixelifySans.ttf) format('truetype');font-weight:400 700;font-display:swap}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:#2b1d16;overflow:hidden;touch-action:none;user-select:none;-webkit-user-select:none}
body{font-variant-ligatures:none;font-family:Pixel,ui-monospace,monospace;color:#3b2618;font-size:16px}
button{font-family:inherit;color:inherit;cursor:pointer}
.hidden{display:none!important}
#app{position:fixed;inset:0;max-width:520px;margin:0 auto;display:flex;flex-direction:column;background:#2b1d16}
#stage{position:relative;flex:1;overflow:hidden;background:#3e6b33}
#game{position:absolute;left:0;top:0;image-rendering:pixelated;image-rendering:crisp-edges;touch-action:none}
.pxi{display:inline-block;width:24px;height:24px;background-size:100% 100%;image-rendering:pixelated;vertical-align:middle;flex:none}
/* pixel panel */
.chip,.card,#tray,#hint,.toast,#place,.pbtn,#bar{border:3px solid #3b2618;box-shadow:inset -3px -3px 0 #d9b98a,inset 3px 3px 0 #fff6df,0 3px 0 #1e130c;background:#f6e7c8;border-radius:0}
#hud{position:absolute;top:calc(env(safe-area-inset-top) + 8px);left:8px;right:8px;display:flex;gap:6px;align-items:center;z-index:20;pointer-events:none}
#hud>*{pointer-events:auto}
.chip{display:flex;align-items:center;gap:5px;height:38px;padding:0 9px;font-size:18px;font-weight:700}
.chip.sq{width:38px;padding:0;justify-content:center}
#mood{flex:1;min-width:0}
#petname{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#pebbles.bump{animation:bump .35s steps(3)}
@keyframes bump{50%{transform:translateY(-4px)}}
#needs{position:absolute;top:calc(env(safe-area-inset-top) + 56px);left:8px;display:flex;flex-direction:column;gap:4px;z-index:19;pointer-events:auto;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.need{display:flex;align-items:center;gap:5px;background:rgba(255,246,223,.9);padding:2px 5px 2px 3px;border:2px solid #3b2618;box-shadow:2px 2px 0 rgba(30,19,12,.35)}
.need .pxi{width:20px;height:20px}
.need s{display:none}
/* v14: a fold handle that says what a tap does: "Hide" with an up chevron under the bars, a down chevron when folded */
.nfold{display:flex;align-items:center;justify-content:center;gap:4px;align-self:flex-start;padding:1px 6px 1px 5px;background:#f0b94e;border:2px solid #3b2618;box-shadow:2px 2px 0 rgba(30,19,12,.35);font-size:11px;line-height:13px;color:#3b2618}
.nfold i{display:block;width:10px;height:6px;background:#3b2618;clip-path:polygon(0 100%,50% 0,100% 100%,80% 100%,50% 40%,20% 100%)}
#needs.mini .nfold{align-self:stretch;padding:0 4px}
#needs.mini .nfold span{display:none}
#needs.mini .nfold i{clip-path:polygon(0 0,20% 0,50% 60%,80% 0,100% 0,50% 100%)}
#foldtip{position:absolute;left:8px;top:calc(env(safe-area-inset-top) + 56px);margin-top:var(--ft,150px);max-width:210px;padding:6px 9px;font-size:13px;line-height:16px;z-index:23;pointer-events:none;background:#fff6df;border:3px solid #3b2618;box-shadow:0 3px 0 #1e130c;animation:tin .25s steps(3)}
#foldtip::before{content:'';position:absolute;left:14px;top:-9px;width:12px;height:6px;background:#3b2618;clip-path:polygon(0 100%,50% 0,100% 100%)}
#needs.mini{flex-direction:row;gap:3px}
#needs.mini .need{padding:2px;position:relative}
#needs.mini .need b{display:none}
#needs.mini .need .pxi{width:16px;height:16px}
#needs.mini .need.low{background:#ffd2c4;border-color:#b8321f}
#needs.mini .need.low s{display:block;position:absolute;right:-4px;top:-4px;width:8px;height:8px;background:#ff5e4d;border:2px solid #3b2618;box-sizing:border-box;animation:needpulse 1.1s steps(2,end) infinite}
@keyframes needpulse{0%{transform:scale(1)}50%{transform:scale(1.35)}100%{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){#needs.mini .need.low s{animation:none}}
.need b{display:block;width:64px;height:11px;background:#e3cfa6;border:2px solid #3b2618;box-sizing:border-box;position:relative}
.need b::after{content:'';position:absolute;left:0;top:0;bottom:0;width:var(--v,50%);background:var(--c,#5fd34a);box-shadow:inset 0 2px 0 rgba(255,255,255,.45),inset 0 -1px 0 rgba(0,0,0,.18)}
#place{position:absolute;left:50%;top:calc(env(safe-area-inset-top) + 56px);transform:translateX(-50%);padding:4px 10px;font-size:15px;font-weight:700;z-index:18;white-space:nowrap;pointer-events:none}
#hint{position:absolute;left:50%;bottom:96px;transform:translateX(-50%);padding:6px 12px;font-size:15px;z-index:22;white-space:nowrap;pointer-events:none}
#tray{position:absolute;left:8px;right:8px;bottom:8px;display:flex;gap:6px;padding:6px;z-index:23;overflow-x:auto}
.ti{flex:1;min-width:60px;display:flex;flex-direction:column;align-items:center;gap:2px;padding:4px 2px;background:#fff6df;border:2px solid #3b2618;font-size:12px;position:relative;touch-action:none}
.ti .pxi{width:32px;height:32px}
.ti.sel{background:#cdeaa8}
.ti.locked{opacity:.45}
.ti .cnt{position:absolute;top:1px;right:3px;font-weight:700;font-size:13px}
.ti.close{flex:0 0 44px;min-width:44px;justify-content:center;font-size:20px;font-weight:700}
#napveil{position:absolute;inset:0;background:rgba(20,18,50,.45);z-index:21;display:flex;align-items:flex-end;justify-content:center;padding-bottom:20px}
/* v14: brighter care bar. Warm honey wood, each action on its own raised pad, icons a touch richer, cream labels */
#bar{display:flex;gap:4px;padding:5px 5px;padding-bottom:calc(env(safe-area-inset-bottom) + 5px);background:#94592c;box-shadow:inset 0 3px 0 #c9884a,inset 0 -2px 0 #6b3f20;border-width:3px 0 0}
#bar button{flex:1;display:flex;flex-direction:column;align-items:center;gap:1px;padding:4px 0 3px;border:0;background:#cf8a45;box-shadow:inset 0 2px 0 #f4bd74,inset 0 -3px 0 #95592a,0 2px 0 #4a2a14;font-size:12px;color:#fffaf0;text-shadow:0 2px 0 #5a3014;-webkit-tap-highlight-color:transparent}
#bar button:active{transform:translateY(1px);box-shadow:inset 0 2px 0 #7a5030,inset 0 -1px 0 #d9a96a}
#bar button.on{background:#f0b94e;color:#3b2618;text-shadow:0 1px 0 #ffe3a0;box-shadow:inset 0 2px 0 #ffe08a,inset 0 -3px 0 #b8812c,0 2px 0 #4a2f1b}
#bar .pxi{width:30px;height:30px;filter:saturate(1.3) brightness(1.08) drop-shadow(0 2px 0 rgba(58,36,20,.55))}
.pbtn{display:block;width:100%;margin:8px 0 0;padding:10px;font-size:18px;font-weight:700}
.pbtn.primary{background:#9bd06a;box-shadow:inset -3px -3px 0 #5e9a3e,inset 3px 3px 0 #d4f3a8,0 3px 0 #1e130c}
.pbtn.ghost{background:#efe0bf;font-size:15px}
.pbtn:active{transform:translateY(2px)}
#modal{position:fixed;inset:0;background:rgba(20,12,8,.55);z-index:60;display:flex;align-items:center;justify-content:center;padding:14px}
.card{width:100%;max-width:400px;max-height:88vh;overflow:auto;padding:14px 14px 12px;text-align:center}
.card h2{margin:2px 0 8px;font-size:22px}
.card p{margin:6px 0;line-height:1.3}
.small{font-size:13px;opacity:.85}
.bigpet{display:block;margin:6px auto;image-rendering:pixelated;width:96px}
.shopgrid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:8px 0}
.shopitem{background:#fff6df;border:2px solid #3b2618;padding:6px;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:13px}
.shopitem .pxi{width:36px;height:36px}
.shopitem small{font-size:11px;opacity:.85;min-height:28px}
.shopitem.owned{background:#e4f1cf}
.buy{margin-top:3px;padding:4px 8px;font-size:15px;font-weight:700;background:#9bd06a;border:2px solid #3b2618;display:flex;align-items:center;gap:3px}
.buy .pxi{width:16px;height:16px}
.buy:disabled{background:#d8ccb0;opacity:.7}
.stages{display:flex;gap:6px;justify-content:center;margin:6px 0}
.stages>div{flex:1;background:#fff6df;border:2px solid #3b2618;padding:4px;font-size:13px}
.stages>div.cur{background:#cdeaa8}
.stages img{width:48px;image-rendering:pixelated;display:block;margin:0 auto}
.stages .ph{font-size:28px;height:48px;line-height:48px}
.meter{height:12px;background:#3b2618;border:2px solid #3b2618;margin:4px 20px}
.meter i{display:block;height:100%;background:#58b8d8}
input.name{width:100%;font-family:inherit;font-size:18px;padding:8px;border:3px solid #3b2618;background:#fff;margin-top:8px}
.row{display:flex;gap:6px}.row .pbtn{flex:1}
#toasts{position:fixed;left:0;right:0;top:calc(env(safe-area-inset-top) + 100px);display:flex;flex-direction:column;align-items:center;gap:6px;z-index:70;pointer-events:none}
.toast{max-width:92%;padding:8px 12px;font-size:15px;animation:tin .25s steps(3)}
@keyframes tin{from{transform:translateY(-8px);opacity:0}}
.dragghost{position:fixed;width:44px;height:44px;margin:-22px 0 0 -22px;z-index:80;pointer-events:none;background-size:100% 100%;image-rendering:pixelated}
/* swim */
.screen{position:fixed;inset:0;z-index:50;background:#1d4f7a;max-width:520px;margin:0 auto;touch-action:none}
#btn-follow{position:absolute;right:8px;top:calc(env(safe-area-inset-top) + 56px);z-index:21;padding:6px 10px;font-size:14px;display:flex;align-items:center;gap:4px}
#btn-follow .pxi{width:20px;height:20px}
#map{background:#86c45a}#mapcv,#tripcv{position:absolute;left:0;top:0;image-rendering:pixelated}
#maphud,#triphud{position:absolute;top:calc(env(safe-area-inset-top) + 8px);left:8px;right:8px;display:flex;gap:6px;z-index:2;flex-wrap:wrap}
#maphud #mapclose,#triphud #tripstop{margin-left:auto}
#mapspots{position:absolute;inset:0;z-index:2;pointer-events:none}
.mapspot{position:absolute;transform:translate(-50%,-50%);pointer-events:auto;display:flex;flex-direction:column;align-items:center;gap:1px;padding:5px 8px;min-width:96px;font:inherit;font-size:13px;color:#3b2618;border:3px solid #3b2618;background:#f6e7c8;box-shadow:inset -3px -3px 0 #d9b98a,inset 3px 3px 0 #fff6df,0 3px 0 #1e130c}
.mapspot .pxi{width:28px;height:28px}.mapspot small{font-size:11px;opacity:.8}
.mapspot em{font-style:normal;font-size:10px;background:#e8c85a;padding:0 4px;border:2px solid #3b2618;text-transform:uppercase}
.mapspot.dim{filter:grayscale(.8);opacity:.6}
#mapnote{position:absolute;left:10px;right:10px;bottom:calc(env(safe-area-inset-bottom) + 10px);z-index:3;width:auto}
#trip{background:#cfeccf}
#tripbar{position:absolute;left:10px;right:10px;top:calc(env(safe-area-inset-top) + 50px);height:8px;border:2px solid #3b2618;background:#f6e7c8;z-index:2}
#tripbar i{display:block;height:100%;width:0;background:#6fbf4a}
#tripearly{position:absolute;left:10px;right:10px;bottom:calc(env(safe-area-inset-bottom) + 10px);z-index:2;width:auto}
#swimcv{position:absolute;left:0;top:0;image-rendering:pixelated}
#swimhud{position:absolute;top:calc(env(safe-area-inset-top) + 8px);left:8px;right:8px;display:flex;gap:6px;z-index:2}
#swimhud #swimstop{margin-left:auto}
#swimintro{position:absolute;left:14px;right:14px;top:50%;transform:translateY(-50%);width:auto;z-index:3}
.namerow{align-items:stretch}.namerow input.name{flex:1;margin-top:8px}
.pbtn.dice{flex:0 0 52px;width:52px;margin-top:8px;padding:0;display:flex;align-items:center;justify-content:center}
.pbtn.dice .pxi{width:28px;height:28px}
.card h2 .pxi,.card p .pxi,.toast .pxi{width:18px;height:18px;vertical-align:-3px}

#fpsov{position:fixed;left:50%;transform:translateX(-50%);top:calc(env(safe-area-inset-top,0px) + 48px);z-index:99;background:rgba(20,12,8,.78);color:#b8ff9c;font:11px/1.3 ui-monospace,Menlo,Consolas,monospace;padding:2px 6px;border:1px solid #000;pointer-events:none;white-space:pre}
.diaglog{max-height:46vh;overflow:auto;background:#1e130c;color:#f3e6c8;font:10px/1.35 ui-monospace,Menlo,Consolas,monospace;padding:6px;text-align:left;white-space:pre-wrap;word-break:break-word;margin:4px 0;font-variant-ligatures:none}
.pbtn.on{background:#cdeaa8}
.dev-h{margin-top:8px;font-weight:bold}

#dbg{position:fixed;left:8px;right:8px;max-width:500px;margin:0 auto;bottom:calc(env(safe-area-inset-bottom,0px) + 8px);max-height:78vh;overflow:auto;z-index:65;padding:8px 10px;box-shadow:0 4px 0 rgba(0,0,0,.35)}
#dbg .row{margin:4px 0}
#dbg .pbtn{padding:6px 4px;font-size:13px}
.dbg-top{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.dbg-top .small{flex:1;opacity:.8;font-size:12px}
.dbg-x{width:30px;height:30px;font:inherit;font-weight:700;border:2px solid #3a2414;background:#f3e6c8;cursor:pointer}
.dbg-hide{display:flex;align-items:center;gap:6px;justify-content:center;font-size:14px;margin:6px 0}
.dbg-hide input{width:20px;height:20px}
