*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:linear-gradient(#f7ecdc,#efdcc2);color:#4a3428;overscroll-behavior:none}
.home{position:fixed;left:8px;top:8px;z-index:50;background:#fffaf2;color:#4a3428;border-radius:999px;padding:5px 11px;font:600 13px system-ui;text-decoration:none;box-shadow:0 2px 6px rgba(0,0,0,.15)}
.wrap{max-width:460px;margin:0 auto;padding:44px 10px 24px}
header{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px}
#rname{flex:1 1 100%;min-width:0;border:0;background:transparent;font:800 19px system-ui;color:#8a5a3b;outline:none;padding:2px 0}
.chips{display:flex;gap:5px}
.chip{border:0;background:#fffaf2;border-radius:999px;padding:5px 9px;font:600 12px system-ui;color:#4a3428;box-shadow:0 1px 3px rgba(0,0,0,.08);white-space:nowrap}
.meters{display:flex;gap:8px;align-items:center;margin:6px 0 8px;font-size:12px}
.m{flex:1;display:flex;align-items:center;gap:5px}
.m i{flex:1;height:9px;background:#e9d6bb;border-radius:9px;overflow:hidden}
.m b{display:block;height:100%;width:50%;background:linear-gradient(90deg,#f4a7b9,#e5566f);border-radius:9px;transition:width .6s}
.lv{flex:0 0 auto;background:#8a5a3b;color:#fff3df;border-radius:8px;padding:2px 8px;font-weight:700}
.room{position:relative;isolation:isolate;width:100%;aspect-ratio:3/4;border-radius:22px;overflow:hidden;box-shadow:0 12px 30px rgba(90,55,30,.28),inset 0 0 0 3px #fff6;touch-action:none;user-select:none;-webkit-user-select:none;background:#ead2b0}
.room .bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none}
.win{position:absolute;left:22.5%;top:15%;width:31%;height:27.5%;border-radius:4px;background:linear-gradient(#0f1f45,#2b3f7a);opacity:0;transition:opacity 1.2s;pointer-events:none;mix-blend-mode:multiply}
.win .moon{position:absolute;right:16%;top:12%;width:16%;aspect-ratio:1;border-radius:50%;background:#fff3c4;box-shadow:0 0 14px 4px #fff3c477}
.night .win{opacity:.9}
.shade{position:absolute;inset:0;pointer-events:none;transition:background 1.2s;background:transparent;mix-blend-mode:multiply}
.dusk .shade{background:rgba(255,170,90,.28)}
.night .shade{background:rgba(40,50,110,.55)}
.layer{position:absolute;inset:0}
.it,.pet{position:absolute;transform:translate(-50%,-100%);touch-action:none}
.it img,.pet img{display:block;width:100%;pointer-events:none;-webkit-user-drag:none}
.it{cursor:grab;filter:drop-shadow(0 5px 4px rgba(80,45,20,.22))}
.it.flip img{transform:scaleX(-1)}
.it.sel{filter:drop-shadow(0 0 0 #fff) drop-shadow(0 0 5px #ff8fb1) drop-shadow(0 0 2px #fff)}
.it.pop{animation:pop .45s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{0%{transform:translate(-50%,-100%) scale(.3)}100%{transform:translate(-50%,-100%) scale(1)}}
.it.wig{animation:wig .5s}
@keyframes wig{25%{transform:translate(-50%,-100%) rotate(-6deg)}75%{transform:translate(-50%,-100%) rotate(6deg)}}
.night .it.glow:before,.dusk .it.glow:before{content:"";position:absolute;left:50%;top:30%;width:260%;aspect-ratio:1;transform:translate(-50%,-50%);background:radial-gradient(circle,rgba(255,214,140,.55),rgba(255,190,110,.18) 40%,transparent 70%);pointer-events:none;mix-blend-mode:screen;z-index:2000}
.night .it.glow{filter:drop-shadow(0 0 10px #ffd58a) brightness(1.15)}
.pet{transition:left var(--d,1.6s) ease-in-out,top var(--d,1.6s) ease-in-out;cursor:pointer}
.pet .bod{transform-origin:50% 100%;animation:breath 2.4s ease-in-out infinite}
.pet.walk .bod{animation:hop .36s ease-in-out infinite}
.pet.flip .bod img{transform:scaleX(-1)}
.pet.happy .bod{animation:jump .5s ease-out 2}
.pet.sleep .bod{animation:breath 3.6s ease-in-out infinite}
@keyframes breath{50%{transform:scale(1.02,.975)}}
@keyframes hop{50%{transform:translateY(-6%) rotate(2deg)}}
@keyframes jump{40%{transform:translateY(-16%) scale(.97,1.04)}}
.pet.eat .bod{animation:eat .4s ease-in-out infinite}
@keyframes eat{50%{transform:translateY(4%) rotate(3deg)}}
.say{position:absolute;bottom:96%;left:50%;transform:translateX(-50%) scale(.6);opacity:0;background:#fffaf2;border-radius:12px;padding:4px 9px;font:600 12px system-ui;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,.18);transition:all .25s;pointer-events:none;z-index:5}
.say.on{opacity:1;transform:translateX(-50%) scale(1)}
.say:after{content:"";position:absolute;left:50%;bottom:-5px;margin-left:-5px;border:5px solid transparent;border-bottom:0;border-top-color:#fffaf2}
.fx{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.fx span{position:absolute;font-size:20px;animation:float 1.6s ease-out forwards}
@keyframes float{0%{opacity:0;transform:translate(-50%,0) scale(.5)}15%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--dx,0px)),-90px) scale(1.2)}}
.fx .z{font:800 16px system-ui;color:#fff;text-shadow:0 1px 3px #0006;animation-duration:2.4s}
.ballfly{position:absolute;width:7%;transition:left .9s cubic-bezier(.2,.7,.4,1),top .9s cubic-bezier(.3,-0.6,.6,1);z-index:3000}
.brand{position:absolute;right:10px;bottom:7px;font:700 10px system-ui;color:#fff;text-shadow:0 1px 3px #0007;pointer-events:none}
.friend{position:absolute;left:8px;right:8px;top:8px;background:#fffaf2ee;border-radius:12px;padding:6px 10px;font-size:12px;z-index:4000}
.friend button{border:0;background:#e5566f;color:#fff;border-radius:8px;padding:3px 8px;font:inherit;font-weight:700}
.tool{position:absolute;left:50%;bottom:10px;transform:translateX(-50%);display:flex;gap:4px;background:#fffaf2;border-radius:999px;padding:4px;box-shadow:0 4px 14px rgba(0,0,0,.2);z-index:4000}
.tool button{border:0;background:#f3e6d3;border-radius:50%;width:38px;height:38px;font-size:16px}
.acts{display:flex;gap:6px;margin:10px 0 6px;overflow-x:auto;scrollbar-width:none}
.acts button{flex:1 0 auto;border:0;background:#fffaf2;border-radius:14px;padding:9px 10px;font:700 13px system-ui;color:#4a3428;box-shadow:0 2px 0 #e2cfb4}
.acts button:active,.grid button:active{transform:translateY(1px);box-shadow:none}
.drawer{background:#fffaf2;border-radius:18px;padding:8px;box-shadow:0 2px 0 #e2cfb4}
.tabs{display:flex;gap:5px;overflow-x:auto;scrollbar-width:none;padding-bottom:6px}
.tabs button{flex:0 0 auto;border:0;border-radius:999px;padding:6px 11px;font:700 12.5px system-ui;background:#f3e6d3;color:#8b7262}
.tabs button.on{background:#8a5a3b;color:#fff3df}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.grid button{position:relative;border:0;background:linear-gradient(#fff,#fbf1e4);border-radius:14px;aspect-ratio:1;padding:6px 4px 16px;box-shadow:0 2px 0 #eadbc6;display:flex;align-items:center;justify-content:center}
.grid img{max-width:84%;max-height:84%;object-fit:contain}
.grid em{position:absolute;bottom:3px;left:0;right:0;font:600 10px system-ui;font-style:normal;color:#8b7262;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grid .n{position:absolute;top:3px;right:5px;font:800 10px system-ui;color:#e5566f}
.hint{font-size:11.5px;color:#8b7262;margin:8px 2px 2px}
.share{display:flex;gap:8px;margin-top:12px}
.big{flex:1;border:0;border-radius:14px;padding:12px;font:800 14.5px system-ui;background:#3f6f6a;color:#fff}
.big.pink{background:#e5566f}
.row2{display:flex;gap:8px;margin-top:8px}
.ghost{flex:1;border:1.5px solid #d8bf9f;background:transparent;border-radius:12px;padding:8px;font:700 13px system-ui;color:#8a5a3b}
.foot{text-align:center;font-size:12px;color:#8b7262}
.foot a{color:#3f6f6a}
.modal{position:fixed;inset:0;background:rgba(40,25,15,.55);display:flex;align-items:center;justify-content:center;z-index:100;padding:16px}
.modal[hidden]{display:none}
.box{position:relative;background:#fffaf2;border-radius:20px;padding:16px;max-width:420px;width:100%;max-height:90vh;overflow:auto;text-align:center}
.box h3{margin:0 0 10px}
.box img{width:100%;border-radius:14px}
.box input{width:100%;font-size:12px;padding:8px;border:1px solid #e2cfb4;border-radius:8px}
.box .big{display:block;width:100%;margin-top:8px;text-decoration:none;text-align:center}
.x{position:absolute;right:8px;top:8px;border:0;background:#efe2cf;border-radius:50%;width:30px;height:30px}
.toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:#4a3428;color:#fff;padding:8px 14px;border-radius:999px;font-size:13px;z-index:200;white-space:nowrap}

.tool[hidden]{display:none}
.acts{display:grid;grid-template-columns:repeat(4,1fr);overflow:visible}
.acts button{padding:9px 2px;font-size:12.5px;white-space:nowrap}
.pet.edgeL .say{left:0;transform:translateX(0) scale(.6)}.pet.edgeL .say.on{transform:translateX(0) scale(1)}.pet.edgeL .say:after{left:22px}
.pet.edgeR .say{left:auto;right:0;transform:translateX(0) scale(.6)}.pet.edgeR .say.on{transform:translateX(0) scale(1)}.pet.edgeR .say:after{left:auto;right:16px}
