/* Critter Garden: tablet landscape first (1400x750), works on a phone (390x844). Touch targets >= 56 px. */
:root { --ink: #2b2540; --paper: #fdf3e1; --card: #fffaf0; --accent: #5a8dee; --sun: #f2b950; --line: #e6dccb; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
#app { height: 100%; }
.kit-feature[data-feature=garden] { height: 100%; display: flex; flex-direction: column; }

/* ---- top bar ---- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; }
.bar h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.9rem; letter-spacing: .01em; }
.logo { font-size: 2.1rem; }
.bar-right { display: flex; align-items: center; gap: 10px; }
.stars { min-width: 104px; padding: 8px 20px; border-radius: 999px; background: var(--card); font-size: 1.7rem; font-weight: 900;
  text-align: center; box-shadow: 0 4px 0 rgba(43,37,64,.12); }
.saving { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: #eef4ff;
  font-size: 1rem; font-weight: 700; }

/* ---- layout ---- */
.play { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 390px; gap: 18px; padding: 0 24px 20px; }

/* ---- garden ---- */
.garden { position: relative; border-radius: 30px; overflow: hidden; container-type: size; background: #8acb72;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.5); }
.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.cloud { animation: drift 38s linear infinite alternate; }
.cloud.c2 { animation-duration: 52s; }
.critters, .fx { position: absolute; inset: 0; }
.fx { pointer-events: none; z-index: 200; }
.critter { position: absolute; width: calc(min(21cqw, 33cqh) * var(--s, 1)); padding: 0; border: 0; background: transparent;
  font: inherit; color: inherit; cursor: pointer; transform: translate(-50%, -100%); display: flex; flex-direction: column;
  align-items: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.critter .critter-art { width: 100%; height: auto; overflow: visible; }
.critter .name { margin-top: -4px; padding: 3px 14px; border-radius: 999px; background: rgba(255,255,255,.85);
  font-size: calc(1.15rem * var(--s, 1)); font-weight: 800; white-space: nowrap; box-shadow: 0 3px 0 rgba(43,37,64,.1); }
.critter.hatch { animation: hatch .6s cubic-bezier(.2,1.6,.4,1); }
.critter:focus-visible { outline: 4px solid var(--accent); outline-offset: 4px; border-radius: 20px; }

/* happy moves (always on, gently) and the bigger one when a child says hi */
.critter-art .bod { transform-box: view-box; transform-origin: 100px 186px; }
.move-hop .bod { animation: hop 1.8s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.move-wiggle .bod { animation: wiggle 1.6s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.move-float .bod { animation: float 3.2s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.move-float .shadow { animation: shadow 3.2s ease-in-out infinite; animation-delay: var(--delay, 0s); transform-box: fill-box; transform-origin: center; }
.move-spin .bod { transform-origin: 100px 120px; animation: spin 4.5s ease-in-out infinite; animation-delay: var(--delay, 0s); }
.critter.cheer .critter-art { animation: cheer .7s cubic-bezier(.3,1.6,.5,1); }
.eye { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; animation-delay: var(--delay, 0s); }
.egg .bod { animation: wobble .5s ease-in-out infinite; }
.egg .name { opacity: .8; }

.puff { position: absolute; transform: translate(-50%, 0); padding: 6px 14px; border-radius: 999px; background: #fff;
  font-size: 1.4rem; font-weight: 900; white-space: nowrap; box-shadow: 0 4px 0 rgba(43,37,64,.12); animation: puff 1.2s ease-out forwards; }

.empty { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: min(80%, 460px); margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 22px; border-radius: 26px;
  background: rgba(255,255,255,.82); font-size: 1.45rem; font-weight: 800; text-align: center; z-index: 150; }
.empty-egg svg { width: 120px; height: 120px; }
.empty-egg .bod { animation: wobble 1.4s ease-in-out infinite; transform-box: view-box; transform-origin: 100px 186px; }

/* ---- maker panel ---- */
.panel { display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: 30px; background: var(--card);
  box-shadow: 0 6px 0 rgba(43,37,64,.08); overflow-x: hidden; overflow-y: auto; }
.maker { display: flex; flex-direction: column; gap: 12px; }
.label { font-size: 1.5rem; font-weight: 900; }
.idea { min-height: 66px; width: 100%; padding: 0 18px; border: 3px solid #d9d0ea; border-radius: 20px; font: inherit;
  font-size: 1.3rem; font-weight: 600; color: var(--ink); background: #fff; -webkit-user-select: text; user-select: text; }
.idea:focus { outline: none; border-color: var(--accent); }
.make { min-height: 70px; font-size: 1.6rem; }
.or { margin: 4px 0 0; font-size: 1.1rem; font-weight: 700; opacity: .7; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chip { min-height: 168px; padding: 8px 4px 10px; border: 3px solid var(--line); border-radius: 22px; background: #fff;
  font: inherit; font-size: 1rem; font-weight: 800; color: var(--ink); cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 2px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 rgba(43,37,64,.08); }
.chip svg { width: min(100%, 100px); height: auto; overflow: visible; }
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(43,37,64,.08); }
.chip:disabled { opacity: .5; }
.tip { margin: auto 0 0; padding: 12px 16px; border-radius: 18px; background: #f3fbe9; font-size: 1.15rem; font-weight: 700; }

@keyframes drift { to { transform: translateX(140px); } }
@keyframes hop { 0%, 55%, 100% { transform: translateY(0) scale(1, 1); } 62% { transform: translateY(0) scale(1.06, .92); }
  75% { transform: translateY(-16px) scale(.97, 1.04); } 88% { transform: translateY(0) scale(1.04, .96); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@keyframes float { 0%, 100% { transform: translateY(-8px); } 50% { transform: translateY(-22px); } }
@keyframes shadow { 0%, 100% { transform: scale(.85); } 50% { transform: scale(.7); } }
@keyframes spin { 0%, 70% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes hatch { from { transform: translate(-50%, -100%) scale(.2); opacity: 0; } }
@keyframes cheer { 0% { transform: none; } 35% { transform: translateY(-34px) scale(1.1); } 65% { transform: translateY(0) scale(1.08, .9); } 100% { transform: none; } }
@keyframes puff { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px); } }

/* ---- phone (portrait): garden on top, maker below ---- */
@media (max-width: 760px) {
  html, body { height: auto; min-height: 100%; }
  .kit-feature[data-feature=garden] { min-height: 100vh; height: auto; }
  .bar { padding: 8px 14px; }
  .bar h1 { font-size: 1.3rem; gap: 6px; }
  .logo { font-size: 1.5rem; }
  .stars { min-width: 78px; padding: 6px 14px; font-size: 1.35rem; }
  .saving-text { display: none; }
  .play { grid-template-columns: 1fr; grid-template-rows: 380px auto; gap: 12px; padding: 0 14px 14px; }
  .garden { border-radius: 24px; }
  .critter { width: calc(min(27cqw, 36cqh) * var(--s, 1)); }
  .critter .name { font-size: calc(.95rem * var(--s, 1)); padding: 2px 10px; }
  .empty { font-size: 1.15rem; }
  .empty-egg svg { width: 84px; height: 84px; }
  .panel { padding: 16px; gap: 10px; overflow: visible; }
  .label { font-size: 1.25rem; }
  .idea { min-height: 58px; font-size: 1.15rem; }
  .make { min-height: 60px; font-size: 1.35rem; }
  .chip { min-height: 112px; font-size: .9rem; }
  .chip svg { width: min(100%, 72px); }
  .tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bod, .eye, .shadow, .cloud, .critter, .critter-art, .puff { animation: none !important; }
}
