:root{
  --ink:#2c2018;
  --cream:#fff8ec;
  --accent:#e0633a;      /* warm orange */
  --accent2:#3a8f6f;     /* teal */
  --gold:#e9a23b;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;height:100%;overflow:hidden;}
body{
  font-family:'Nunito',system-ui,sans-serif;
  color:var(--ink);
  user-select:none; -webkit-user-select:none;
  touch-action:none;
  overscroll-behavior:none;
  /* cozy backdrop behind the framed photo (matches wallpaper→floor) */
  background:linear-gradient(180deg,#b9a06d 0%, #a98a55 38%, #7d5d39 72%, #5c4226 100%);
}

/* ---------- Scene (the photo, above the drawer) ---------- */
#scene{
  position:fixed; left:0; right:0; top:0;
  bottom:var(--drawerH,150px);
  overflow:hidden;
}
#bg{
  position:absolute; left:0; top:0;
  width:100%; height:100%;
  object-fit:contain;
  pointer-events:none;
  -webkit-user-drag:none;
}

/* glow ring that highlights a target while dragging */
.glow{
  position:absolute; pointer-events:none; z-index:25;
  border-radius:16px;
  opacity:0; transition:opacity .22s ease;
  box-shadow:0 0 0 3px rgba(233,162,59,.9), 0 0 36px 8px rgba(233,162,59,.5);
  background:rgba(233,162,59,.10);
}
.glow.show{ opacity:1; animation:targetpulse 1s ease-in-out infinite; }
.glow.hot{ box-shadow:0 0 0 4px rgba(58,143,111,1), 0 0 46px 12px rgba(58,143,111,.55);
           background:rgba(58,143,111,.14); }
.glow.locked{ opacity:1; animation:none;
           box-shadow:0 0 0 3px rgba(58,143,111,.85), 0 0 44px 10px rgba(58,143,111,.4); }
@keyframes targetpulse{ 0%,100%{transform:scale(1);} 50%{transform:scale(1.035);} }

/* ---------- Draggable cats ---------- */
.cat{
  position:fixed; left:0; top:0; z-index:30;
  width:150px; height:auto;
  transform:translate(-50%,-50%) scale(.9) rotate(0deg);
  transform-origin:center center;
  cursor:grab;
  -webkit-user-drag:none;
  filter:drop-shadow(0 10px 14px rgba(20,10,4,.45));
  transition:transform .5s cubic-bezier(.34,1.56,.64,1),
             left .5s cubic-bezier(.34,1.56,.64,1),
             top .5s cubic-bezier(.34,1.56,.64,1),
             filter .25s ease;
  will-change:left,top,transform;
}
.cat.idle{ animation:bob 2.6s ease-in-out infinite; }
@keyframes bob{
  0%,100%{ transform:translate(-50%,-50%) scale(.9) rotate(-3deg); }
  50%{ transform:translate(-50%,-52%) scale(.92) rotate(3deg); }
}
.cat.dragging{
  transition:filter .2s ease;
  transform:translate(-50%,-50%) scale(1.06) rotate(-4deg);
  filter:drop-shadow(0 26px 22px rgba(20,10,4,.5));
  cursor:grabbing; animation:none; z-index:34;
}
.cat.wrong{ animation:nope .45s ease; }
@keyframes nope{
  0%,100%{ transform:translate(-50%,-50%) scale(.9) rotate(0); }
  20%{ transform:translate(-58%,-50%) scale(.9) rotate(-8deg); }
  50%{ transform:translate(-44%,-50%) scale(.9) rotate(8deg); }
  75%{ transform:translate(-52%,-50%) scale(.9) rotate(-4deg); }
}
.cat.placed{
  transition:transform .65s cubic-bezier(.34,1.56,.64,1),
             left .65s cubic-bezier(.34,1.56,.64,1),
             top .65s cubic-bezier(.34,1.56,.64,1);
  filter:drop-shadow(0 8px 10px rgba(20,10,4,.5));
  animation:none; cursor:default;
}

/* ---------- Bottom drawer ---------- */
#drawer{
  position:fixed; left:0; right:0; bottom:0; z-index:20;
  background:linear-gradient(180deg,#fffaf1 0%, #fbeed7 100%);
  border-radius:24px 24px 0 0;
  box-shadow:0 -12px 34px rgba(30,16,6,.34);
  padding:8px 14px calc(14px + env(safe-area-inset-bottom)) 14px;
  transition:transform .5s cubic-bezier(.34,1.4,.64,1), opacity .4s ease;
}
#drawer.hidden{ transform:translateY(110%); opacity:0; pointer-events:none; }
#handle{ width:44px; height:5px; border-radius:99px; background:#d8c19a; margin:2px auto 9px; }

.drawer-head{
  text-align:center; margin:0 0 9px;
}
.drawer-head h1{
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:800;
  font-size:17px; line-height:1.05; margin:0; color:var(--ink);
}
.drawer-head p{
  font-size:12px; line-height:1.25; margin:3px 0 0; color:#8a755c; font-weight:600;
}
.drawer-head .hl{ color:var(--accent); font-weight:800; }

.slots{ display:flex; gap:12px; }
.slot{
  position:relative; flex:1 1 0; min-width:0;
  height:104px; border-radius:18px;
  background:repeating-linear-gradient(45deg,#f4e6cb,#f4e6cb 9px,#efdfbd 9px,#efdfbd 18px);
  border:2px dashed #d3b783;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-end;
  padding-bottom:7px;
  transition:opacity .4s ease, background .4s ease, border-color .4s ease;
}
.slot .tag{
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:800; font-size:13px;
  color:#7a6446; background:rgba(255,255,255,.6); padding:2px 10px; border-radius:99px;
}
.slot.done{
  background:#eaf6ef; border-color:#9fd3bc; border-style:solid;
}
.slot.done .tag{ color:var(--accent2); background:rgba(255,255,255,.7); }
.slot .check{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:40px; opacity:0; transform:scale(.4); pointer-events:none;
  transition:opacity .35s ease, transform .45s cubic-bezier(.34,1.7,.5,1);
}
.slot.done .check{ opacity:1; transform:scale(1); }

/* hint bubble near a cat */
.tip{
  position:fixed; z-index:31; pointer-events:none;
  background:var(--ink); color:var(--cream);
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:700; font-size:12px;
  padding:6px 11px; border-radius:13px;
  transform:translate(-50%,-50%) scale(1);
  box-shadow:0 6px 16px rgba(20,10,4,.4);
  transition:opacity .3s ease, transform .3s ease; white-space:nowrap;
}
.tip::after{
  content:""; position:absolute; left:50%; bottom:-5px;
  width:11px; height:11px; background:var(--ink);
  transform:translateX(-50%) rotate(45deg);
}
.tip.hide{ opacity:0; transform:translate(-50%,-40%) scale(.9); }

/* ---------- Confetti ---------- */
#confetti{ position:fixed; inset:0; z-index:40; pointer-events:none; }

/* ---------- Win banner (small, bottom, non-blocking) ---------- */
#win{
  position:fixed; left:50%; bottom:calc(14px + env(safe-area-inset-bottom)); z-index:50;
  transform:translateX(-50%) translateY(140%);
  width:auto; max-width:min(92vw,420px);
  display:flex; align-items:center; gap:11px;
  background:linear-gradient(180deg,#fffaf1,#fbedd2);
  border-radius:18px; padding:11px 16px 11px 13px;
  box-shadow:0 12px 34px rgba(10,5,2,.4);
  opacity:0; pointer-events:none;
  transition:transform .6s cubic-bezier(.34,1.56,.64,1), opacity .4s ease;
}
#win.show{ opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; }
.trophy{ font-size:30px; line-height:1; flex:0 0 auto; display:inline-block;
  animation:trophypop .8s cubic-bezier(.34,1.7,.5,1) both; }
@keyframes trophypop{ 0%{transform:scale(0) rotate(-25deg);} 70%{transform:scale(1.2) rotate(8deg);} 100%{transform:scale(1) rotate(0);} }
.win-text{ min-width:0; }
.win-text h2{
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:800;
  font-size:15px; line-height:1.05; margin:0 0 1px; color:var(--ink);
}
.win-text p{ font-size:12px; line-height:1.25; margin:0; color:#8a755c; font-weight:600; }
.win-text p b{ color:var(--accent); }
.win-text p b.t{ color:var(--accent2); }
#again{
  appearance:none; border:none; cursor:pointer; flex:0 0 auto;
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:700; font-size:13px;
  color:#fff; background:var(--accent);
  padding:8px 14px; border-radius:12px;
  box-shadow:0 4px 0 #b34a26;
  transition:transform .12s ease, box-shadow .12s ease;
}
#again:active{ transform:translateY(3px); box-shadow:0 1px 0 #b34a26; }

/* top label */
#topcard{
  position:fixed; top:calc(10px + env(safe-area-inset-top)); left:50%; z-index:22;
  transform:translateX(-50%);
  background:rgba(255,250,241,.92); backdrop-filter:blur(6px);
  padding:7px 16px; border-radius:99px;
  box-shadow:0 6px 18px rgba(20,10,4,.28);
  font-family:'Baloo 2','Nunito',sans-serif; font-weight:700; font-size:13.5px;
  color:var(--ink); white-space:nowrap; transition:opacity .4s ease;
}
#topcard .paw{ color:var(--accent); }
