*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;user-select:none;-webkit-user-select:none}
html,body{margin:0;height:100%;overflow:hidden;background:#8fd0f5;font-family:"Baloo 2","Nunito","Trebuchet MS",system-ui,sans-serif;touch-action:manipulation}
#app{position:fixed;inset:0;overflow:hidden}
#sky{position:absolute;inset:0;background:linear-gradient(#7cc8f2 0%,#bfe6fb 55%,#d9f2c4 70%,#9fd76b 100%)}
#hills{position:absolute;left:-10%;right:-10%;bottom:0;height:34%;
  background:radial-gradient(ellipse 60% 70% at 25% 100%,#7ec44f 60%,transparent 61%),
             radial-gradient(ellipse 55% 60% at 80% 100%,#8fcf58 60%,transparent 61%),
             linear-gradient(transparent 55%,#6db544 55%)}
.screen{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center}
.hidden{display:none!important}
svg{width:60%;height:60%;fill:currentColor}

/* buttons */
button{border:0;cursor:pointer;font:inherit;color:#fff;padding:0}
.bigbtn{width:96px;height:96px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#8ee05a,#3fa62a 70%);
  box-shadow:0 7px 0 #2b7a1c,0 12px 18px rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;transition:transform .1s}
.bigbtn:active{transform:translateY(5px);box-shadow:0 2px 0 #2b7a1c}
.bigbtn.alt{background:radial-gradient(circle at 35% 30%,#ffd866,#f0a51c 70%);box-shadow:0 7px 0 #b06f0a,0 12px 18px rgba(0,0,0,.25)}
.roundbtn{width:64px;height:64px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffd866,#f0a51c 70%);
  box-shadow:0 5px 0 #b06f0a;display:flex;align-items:center;justify-content:center}
.roundbtn.small{width:46px;height:46px;box-shadow:0 4px 0 #b06f0a}
.roundbtn:active{transform:translateY(3px);box-shadow:0 1px 0 #b06f0a}

/* title */
#title{justify-content:center;gap:4vh}
#logo{display:flex;flex-direction:column;align-items:center;line-height:.85;transform:rotate(-3deg)}
#logo span{font-weight:900;color:#fff;-webkit-text-stroke:3px #b5561b;paint-order:stroke fill;text-shadow:0 6px 0 #b5561b,0 10px 14px rgba(0,0,0,.25)}
#logo .l1{font-size:min(17vw,96px);color:#ffcf3f}
#logo .l2{font-size:min(14vw,80px)}
#titleFam{display:flex;align-items:flex-end;gap:2px;height:min(36vw,190px)}
#titleFam img{border-radius:22px;border:5px solid #fff;box-shadow:0 8px 16px rgba(0,0,0,.2);animation:bob 2.4s ease-in-out infinite}
#titleFam img:nth-child(2){animation-delay:.3s}#titleFam img:nth-child(3){animation-delay:.6s}
#albumBtn0{position:absolute;right:18px;bottom:22px}
@keyframes bob{50%{transform:translateY(-8px)}}

/* game */
#topbar{position:relative;z-index:5;width:100%;max-width:640px;display:flex;align-items:center;gap:8px;padding:max(10px,env(safe-area-inset-top)) 10px 6px}
#lvl{display:flex;align-items:center;gap:2px;background:#fff;border-radius:22px;padding:2px 12px 2px 4px;height:40px;box-shadow:0 3px 0 #d7c39b;color:#f0a51c}
#lvl svg{width:30px;height:30px}#lvl b{color:#7a4a1c;font-size:24px}
#barn{flex:1;display:flex;align-items:center;gap:4px;background:rgba(255,255,255,.75);border-radius:22px;height:40px;padding:0 6px;overflow:hidden}
#barnIcon{width:32px;height:32px;flex:none;background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M3 14 16 4l13 10v15H3z" fill="%23d8452b"/><path d="M16 4 3 14h3l10-7.6L26 14h3z" fill="%23fff"/><rect x="11" y="17" width="10" height="12" fill="%23fff"/><path d="M11 17l10 12M21 17 11 29" stroke="%23d8452b" stroke-width="2"/></svg>') center/contain no-repeat}
#barnRow{flex:1;height:14px;border-radius:7px;background:#e9dcc0;overflow:hidden}
#barnRow>div{height:100%;width:0;background:linear-gradient(#8ee05a,#4caf50);border-radius:7px;transition:width .45s}
#barnNum{font-weight:900;color:#7a4a1c;font-size:18px;padding:0 4px}
.bslot{width:26px;height:26px;border-radius:50%;background:#e9dcc0;border:2px dashed #c9b28a;overflow:hidden;flex:none}
.bslot img{width:100%;height:100%;object-fit:cover}
.bslot.done{border:2px solid #4caf50;animation:pop .4s}
@keyframes pop{50%{transform:scale(1.4)}}
#soundBtn.off{filter:grayscale(1) brightness(.9)}

#board{position:relative;flex:1;width:100%;max-width:640px}
.tile{position:absolute;border-radius:18%;background:#fff;padding:0;box-shadow:0 4px 0 #cbb98f,0 6px 10px rgba(0,0,0,.18);
  transition:left .32s cubic-bezier(.3,1.4,.6,1),top .32s cubic-bezier(.3,1.4,.6,1),width .32s,height .32s,filter .25s,transform .2s;cursor:pointer}
.tile img{position:absolute;left:5%;top:5%;width:90%;height:90%;border-radius:14%;display:block;pointer-events:none}
.tile.covered{filter:brightness(.55) saturate(.6);cursor:default}
.tile.hint{animation:hint .7s ease-in-out infinite}
@keyframes hint{50%{transform:scale(1.12) rotate(-4deg);box-shadow:0 0 0 5px #ffd23f,0 6px 10px rgba(0,0,0,.2)}}
.tile.gone{transform:scale(0) rotate(30deg);opacity:0;transition:all .45s ease-in}
.tile.jump{animation:jump .35s ease-out}
@keyframes jump{40%{transform:translateY(-30%) scale(1.15)}}
.tile.shake{animation:shake .4s}
@keyframes shake{25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}

#trayWrap{position:relative;z-index:4;width:100%;max-width:640px;padding:6px 8px}
#tray{height:var(--slot,64px);margin:0 auto;border-radius:16px;background:linear-gradient(#b8763a,#8e5627);box-shadow:inset 0 4px 0 rgba(255,255,255,.25),0 6px 0 #5f3815,0 10px 14px rgba(0,0,0,.25);display:flex;padding:4px;gap:3px;box-sizing:content-box}
#tray .slot{flex:1;border-radius:12px;background:rgba(0,0,0,.18)}
#tray.full{animation:shake .4s}
#tools{position:relative;z-index:4;display:flex;gap:22px;padding:8px 0 max(14px,env(safe-area-inset-bottom))}
.tool{position:relative;width:62px;height:62px;border-radius:18px;background:radial-gradient(circle at 35% 30%,#6fc6ff,#2b8fe0 70%);box-shadow:0 5px 0 #1b62a3;display:flex;align-items:center;justify-content:center}
.tool:active{transform:translateY(3px);box-shadow:0 2px 0 #1b62a3}
.tool i{position:absolute;right:-6px;top:-6px;min-width:24px;height:24px;border-radius:12px;background:#ff5a4f;font-style:normal;font-weight:800;font-size:15px;line-height:24px;border:2px solid #fff}
.tool.empty i{background:#3fa62a}
.tool.empty i::before{content:"▶";font-size:11px}
#hand{position:absolute;z-index:90;width:58px;height:58px;pointer-events:none;display:none;
  background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M24 30V10a5 5 0 0 1 10 0v15l14 4a6 6 0 0 1 4 7l-3 16a8 8 0 0 1-8 7H29a8 8 0 0 1-6-3L11 40a5 5 0 0 1 7-7z" fill="%23fff" stroke="%23333" stroke-width="3" stroke-linejoin="round"/></svg>') center/contain no-repeat;
  animation:tap 1s ease-in-out infinite}
@keyframes tap{50%{transform:translate(-6px,-10px) scale(.9)}}

/* overlays */
.overlay{position:absolute;inset:0;z-index:100;background:rgba(30,60,20,.45);display:flex;align-items:center;justify-content:center;animation:fade .25s}
@keyframes fade{from{opacity:0}}
.card{background:#fff8e6;border:6px solid #fff;border-radius:30px;box-shadow:0 10px 0 #d7c39b,0 20px 40px rgba(0,0,0,.3);padding:22px;display:flex;flex-direction:column;align-items:center;gap:18px;max-width:92vw;animation:cardin .4s cubic-bezier(.3,1.5,.6,1)}
.card.wide{width:min(92vw,620px);max-height:86vh}
@keyframes cardin{from{transform:scale(.6)}}
#howRow,#sadRow,#parade{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:center}
#howRow img,#sadRow img,#parade img{width:min(19vw,92px);height:min(19vw,92px);border-radius:18px;border:4px solid #fff;box-shadow:0 4px 8px rgba(0,0,0,.15)}
#parade img{width:min(13vw,64px);height:min(13vw,64px);animation:bob 1.6s ease-in-out infinite}
.sym{font-size:min(9vw,44px);font-weight:900;color:#f0a51c}
.house{width:min(19vw,92px);height:min(19vw,92px);background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M3 14 16 4l13 10v15H3z" fill="%23d8452b"/><path d="M16 4 3 14h3l10-7.6L26 14h3z" fill="%23fff"/><rect x="11" y="17" width="10" height="12" fill="%23fff"/><path d="M11 17l10 12M21 17 11 29" stroke="%23d8452b" stroke-width="2"/></svg>') center/contain no-repeat}
.heart{font-size:min(9vw,44px);color:#ff5a7a}
#stars{display:flex;gap:6px;font-size:min(16vw,76px);line-height:1}
#stars span{color:#cdb98e;-webkit-text-stroke:3px #fff;paint-order:stroke fill;transform:scale(0);animation:star .45s forwards}
#stars span.on{color:#ffc928}
#stars span:nth-child(2){animation-delay:.2s}#stars span:nth-child(3){animation-delay:.4s}
@keyframes star{60%{transform:scale(1.3)}to{transform:scale(1)}}
#newStick{display:flex;align-items:center;gap:8px;font-weight:900;font-size:26px;color:#7a4a1c}
#newStick .book{width:44px;height:44px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffd866,#f0a51c 70%);display:flex;align-items:center;justify-content:center;color:#fff}
.row2{display:flex;gap:26px}
#albumHead{width:100%;display:flex;align-items:center;justify-content:space-between}
#albumCount{display:flex;align-items:center;gap:8px;font-weight:900;font-size:28px;color:#7a4a1c}
#albumGrid{width:100%;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;padding:4px}
.stk{background:#fff;border-radius:16px;padding:6px;display:flex;gap:2px;align-items:flex-end;box-shadow:0 3px 0 #e2d2ad}
.stk img{width:33%;border-radius:8px}
.stk.locked img{filter:brightness(0) opacity(.18)}
/* effects */
#fx{position:absolute;inset:0;pointer-events:none;z-index:110;overflow:hidden}
.conf{position:absolute;width:10px;height:14px;border-radius:3px;animation:fall 1.6s ease-in forwards}
@keyframes fall{to{transform:translate(var(--dx),110vh) rotate(720deg)}}
.flyheart{position:absolute;font-size:34px;color:#ff5a7a;animation:up 1s ease-out forwards}
@keyframes up{to{transform:translateY(-90px) scale(1.4);opacity:0}}
