:root {
  --ink: #17364a;
  --teal: #25bcae;
  --teal-dark: #11877f;
  --cream: #fffaf0;
  --dock-h: 168px;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #c9f7f4;
  color: var(--ink);
  touch-action: none;
  user-select: none;
}

button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.game-shell { position: relative; width: 100%; height: 100%; min-height: 560px; overflow: hidden; }

.topbar {
  position: absolute;
  z-index: 20;
  inset: 0 0 auto;
  height: 92px;
  display: grid;
  grid-template-columns: 78px 1fr 78px;
  align-items: center;
  padding: 7px 16px;
  background: linear-gradient(180deg, rgba(205, 249, 246, .98), rgba(205, 249, 246, .88));
  backdrop-filter: blur(8px);
}

.round-button {
  width: 54px;
  height: 54px;
  border: 3px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #315468;
  background: rgba(255, 255, 255, .75);
  box-shadow: 0 5px 0 rgba(54, 103, 117, .18), 0 6px 15px rgba(33, 83, 95, .16);
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.reset-button { justify-self: end; font-size: 34px; }
.round-button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(54, 103, 117, .18); }

.title-block { text-align: center; align-self: center; }
.title-block h1 { margin: 0; font-size: clamp(31px, 3.3vw, 48px); line-height: .98; letter-spacing: 2px; text-shadow: 0 3px 0 #fff; }
.title-block p { margin: 5px 0 0; color: #3f6870; font-size: clamp(15px, 1.45vw, 21px); font-weight: 800; }

.bathroom {
  position: absolute;
  inset: 88px 20px var(--dock-h);
  overflow: hidden;
  border: 5px solid rgba(255, 255, 255, .88);
  border-radius: 25px;
  background: url("../shared/generated_assets/bath_time_bg_optimized.webp") center 48% / cover no-repeat;
  box-shadow: 0 10px 28px rgba(34, 105, 123, .18), inset 0 0 0 2px rgba(43, 159, 180, .14);
}

.bathroom::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 66%, rgba(255,255,255,.08) 0 24%, rgba(218,247,249,.04) 52%, rgba(25,113,137,.08) 100%);
}

.status-row { position: absolute; z-index: 5; top: 12px; left: 15px; right: 15px; display: flex; justify-content: space-between; gap: 10px; }
.status-pill {
  padding: 8px 16px;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: #356475;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(33, 89, 105, .13);
}
.collection-pill { color: #b46819; background: rgba(255, 247, 212, .9); }

.animal-stage {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: -5px;
  width: min(45vw, 470px);
  height: calc(100% - 42px);
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: filter .2s, transform .2s;
}

.animal-stage.drop-ready { filter: drop-shadow(0 0 18px #fff36b); transform: translateX(-50%) scale(1.025); }
.animal-stage.wrong { animation: stage-shake .34s ease; }

.stage-glow {
  position: absolute;
  left: 50%;
  bottom: 15px;
  width: 74%;
  height: 45%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(235, 255, 236, .26);
  filter: blur(13px);
}

.animal-image {
  position: relative;
  z-index: 2;
  width: auto;
  height: min(100%, 490px);
  max-width: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 6px rgba(27, 78, 87, .24));
  transition: opacity .16s ease, transform .28s cubic-bezier(.2,.9,.35,1.2);
}
.animal-image.changing { opacity: .25; transform: scale(.9); }
.animal-image.pop { animation: animal-pop .48s cubic-bezier(.15,.9,.25,1.2); }

.animal-name {
  position: absolute;
  z-index: 6;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border: 2px solid white;
  border-radius: 999px;
  color: #335261;
  background: rgba(255,255,255,.9);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 4px 9px rgba(21,68,79,.17);
}

.praise {
  position: absolute;
  z-index: 10;
  top: 56px;
  left: 50%;
  min-width: 190px;
  transform: translate(-50%, -15px) scale(.8);
  opacity: 0;
  text-align: center;
  padding: 8px 20px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #fff2a6;
  color: #a34e12;
  font-size: clamp(18px, 2vw, 27px);
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(92, 59, 15, .18);
  pointer-events: none;
}
.praise.show { animation: praise-in 1.15s ease both; }

.wash-effects { position: absolute; z-index: 5; inset: 8% 8% 5%; pointer-events: none; overflow: hidden; }
.effect-bubble { position: absolute; bottom: -30px; border: 3px solid rgba(255,255,255,.92); border-radius: 50%; background: rgba(145,228,255,.28); box-shadow: inset 3px 3px 5px rgba(255,255,255,.8); animation: bubble-rise var(--duration) ease-out forwards; }
.effect-drop { position: absolute; top: -40px; width: 8px; height: 26px; border-radius: 999px; background: linear-gradient(#d9fbff, #48c9f0); animation: rain-down var(--duration) ease-in forwards; }
.effect-sparkle { position: absolute; color: #ffe94d; font-size: var(--size); text-shadow: 0 0 5px white; animation: sparkle-pop 1.1s ease-out forwards; }

.tool-dock {
  position: absolute;
  z-index: 25;
  left: 20px;
  right: 20px;
  bottom: 12px;
  height: calc(var(--dock-h) - 16px);
  border: 4px solid rgba(255, 255, 255, .9);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(220,251,248,.94));
  box-shadow: 0 8px 25px rgba(41, 101, 113, .2);
}

.progress-wrap { height: 39px; display: flex; justify-content: center; align-items: center; gap: 7px; }
.progress-step { display: flex; align-items: center; gap: 5px; color: #8aa2aa; font-size: 14px; font-weight: 900; white-space: nowrap; }
.progress-step b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: white; background: #a9bdc3; font-size: 13px; }
.progress-step.active { color: #148b82; }
.progress-step.active b { background: var(--teal); box-shadow: 0 0 0 4px rgba(46,196,182,.16); }
.progress-step.done { color: #4e9f79; }
.progress-step.done b { background: #6dcc91; }
.progress-line { width: clamp(22px, 5vw, 76px); height: 5px; border-radius: 999px; background: #d5e5e6; }

.tools { height: calc(100% - 39px); display: flex; align-items: center; justify-content: center; gap: clamp(22px, 7vw, 100px); }
.tool-card {
  position: relative;
  width: clamp(116px, 14vw, 176px);
  height: 100px;
  border: 3px solid rgba(255,255,255,.95);
  border-radius: 22px;
  background: rgba(255,255,255,.66);
  color: #294f61;
  box-shadow: 0 6px 0 #b5dedd, 0 9px 17px rgba(32, 91, 103, .16);
  cursor: grab;
  touch-action: none;
  transition: transform .18s, opacity .2s, filter .2s;
}
.tool-card img { width: 76px; height: 70px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 5px 5px rgba(35,75,78,.22)); }
.tool-card span { display: block; margin-top: -7px; font-size: 16px; font-weight: 900; pointer-events: none; }
.tool-card.expected { border-color: #4cd8cb; animation: expected-pulse 1.4s ease-in-out infinite; }
.tool-card.used { opacity: .35; filter: grayscale(.35); pointer-events: none; transform: scale(.92); box-shadow: 0 3px 0 #b5dedd; }
.tool-card:not(.used):active { cursor: grabbing; transform: translateY(4px) scale(.97); box-shadow: 0 2px 0 #b5dedd; }

.next-panel { height: 100%; padding: 13px 30px; display: flex; align-items: center; justify-content: center; gap: clamp(30px, 8vw, 110px); }
.next-panel[hidden] { display: none; }
.finished-copy { display: flex; flex-direction: column; color: #49717a; font-size: 17px; font-weight: 800; }
.finished-copy strong { color: #13857c; font-size: clamp(22px, 2.2vw, 30px); }
.next-button {
  min-width: 210px;
  height: 72px;
  padding: 0 28px;
  border: 4px solid white;
  border-radius: 24px;
  background: linear-gradient(180deg, #ff8c5d, #ff6648);
  color: white;
  font-size: 25px;
  font-weight: 900;
  box-shadow: 0 7px 0 #c94c35, 0 10px 20px rgba(129,58,36,.22);
  cursor: pointer;
  animation: next-breathe 1.7s ease-in-out infinite;
}
.next-button span { margin-left: 9px; font-size: 31px; }
.next-button:active { transform: translateY(5px); box-shadow: 0 2px 0 #c94c35; }

.drag-ghost { position: fixed; z-index: 999; width: 116px; height: 116px; display: none; place-items: center; border-radius: 50%; background: rgba(255,255,255,.84); border: 4px solid white; box-shadow: 0 10px 28px rgba(28,81,93,.28); pointer-events: none; transform: translate(-50%, -50%); }
.drag-ghost.visible { display: grid; }
.drag-ghost img { width: 90px; height: 90px; object-fit: contain; }

@keyframes stage-shake { 25% { transform: translateX(calc(-50% - 13px)) rotate(-2deg); } 55% { transform: translateX(calc(-50% + 12px)) rotate(2deg); } 80% { transform: translateX(calc(-50% - 5px)); } }
@keyframes animal-pop { 0% { transform: scale(.85); } 65% { transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes praise-in { 0% { opacity:0; transform:translate(-50%,-14px) scale(.75); } 22%,72% { opacity:1; transform:translate(-50%,0) scale(1); } 100% { opacity:0; transform:translate(-50%,-12px) scale(.94); } }
@keyframes expected-pulse { 50% { transform: translateY(-4px); box-shadow: 0 10px 0 #9cd7d1, 0 13px 22px rgba(32,91,103,.18); } }
@keyframes next-breathe { 50% { transform: translateY(-3px) scale(1.025); } }
@keyframes bubble-rise { 0% { transform:translateY(0) scale(.65); opacity:0; } 16% { opacity:1; } 100% { transform:translate(var(--drift), -420px) scale(1.15); opacity:0; } }
@keyframes rain-down { 0% { transform:translateY(0) rotate(8deg); opacity:0; } 12% { opacity:.95; } 100% { transform:translate(var(--drift), 490px) rotate(8deg); opacity:0; } }
@keyframes sparkle-pop { 0% { transform:scale(.1) rotate(0); opacity:0; } 35% { opacity:1; transform:scale(1.2) rotate(80deg); } 100% { transform:scale(.3) rotate(160deg); opacity:0; } }

@media (max-width: 700px), (max-height: 620px) {
  :root { --dock-h: 142px; }
  .topbar { height: 76px; padding: 5px 10px; grid-template-columns: 58px 1fr 58px; }
  .round-button { width: 46px; height: 46px; font-size: 35px; }
  .reset-button { font-size: 29px; }
  .title-block h1 { font-size: 30px; }
  .title-block p { margin-top: 3px; font-size: 14px; }
  .bathroom { inset: 74px 8px var(--dock-h); border-width: 3px; border-radius: 18px; }
  .status-row { top: 7px; left: 8px; right: 8px; }
  .status-pill { padding: 5px 9px; font-size: 12px; }
  .animal-stage { width: min(78vw, 390px); height: calc(100% - 27px); }
  .animal-name { font-size: 13px; bottom: 3px; padding: 3px 9px; }
  .praise { top: 42px; font-size: 18px; }
  .tool-dock { left: 7px; right: 7px; bottom: 5px; height: calc(var(--dock-h) - 8px); border-width: 3px; border-radius: 19px; }
  .progress-wrap { height: 32px; gap: 4px; }
  .progress-step { font-size: 11px; }
  .progress-step b { width: 19px; height: 19px; font-size: 10px; }
  .progress-line { width: 16px; height: 4px; }
  .tools { height: calc(100% - 32px); gap: 11px; }
  .tool-card { width: 30%; max-width: 120px; height: 84px; border-radius: 16px; }
  .tool-card img { width: 60px; height: 58px; }
  .tool-card span { font-size: 13px; }
  .next-panel { padding: 9px 13px; gap: 18px; }
  .finished-copy { font-size: 13px; }
  .finished-copy strong { font-size: 19px; }
  .next-button { min-width: 160px; height: 61px; padding: 0 16px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
