* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
  background: #fdf4e7;
}

/* ---------- kambarys ---------- */
#room { position: fixed; inset: 0; z-index: 0; }
#wall {
  position: absolute; left: 0; right: 0; top: 0; height: 68%;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.7) 0 2px, transparent 3px) 0 0 / 46px 46px,
    radial-gradient(ellipse at 50% 35%, #fffaf2 0%, #fbefdd 45%, #f1dcc0 100%);
}
#wall::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(#fffdf8, #eadbc5);
  box-shadow: 0 2px 6px rgba(120, 80, 30, .15);
}
#floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 32%;
  background:
    repeating-linear-gradient(180deg, transparent 0 46px, rgba(110, 60, 15, .13) 46px 48px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 3px, transparent 3px 11px),
    linear-gradient(180deg, #e9c08a, #cf9c60);
}

/* ---------- scena ---------- */
#stage {
  position: fixed; left: 0; right: 0; top: 0;
  bottom: calc(var(--tbh, 104px) + env(safe-area-inset-bottom));
  z-index: 1;
}
#mimi { width: 100%; height: 100%; display: block; overflow: visible; cursor: pointer; }

/* SVG dalių sukimosi taškai (viewBox koordinatėmis) */
#mimi g, #mimi ellipse { transform-box: view-box; }
#shadow       { transform-origin: 200px 476px; }
#mimi-root    { transform-origin: 200px 476px; }
#mimi-fall    { transform-origin: 70px 470px; }
#mimi-wobble  { transform-origin: 200px 470px; }
#mimi-squash  { transform-origin: 200px 476px; }
#mimi-breathe { transform-origin: 200px 476px; animation: breathe 7s ease-in-out infinite; }
#armL   { transform-origin: 94px 252px; }
#armR   { transform-origin: 306px 252px; }
#earL   { transform-origin: 96px 100px; }
#earR   { transform-origin: 302px 110px; }
#balloonBody { transform-origin: 380px 172px; }
#hat { transform-box: view-box; }
#balloon { transition: opacity .1s; }
#legL   { transform-origin: 154px 392px; }
#legR   { transform-origin: 246px 392px; }
#tail, #tail-idle { transform-origin: 300px 415px; }
#tail-idle { animation: tailIdle 3.2s ease-in-out infinite; }
#snout  { transform-origin: 199px 228px; }
#belly  { transform-origin: 202px 354px; }
#mouth  { transform-origin: 199px 234px; transform: scale(0); }

.lid { transition: transform .1s ease; }
.lidline, .happy, .dizzy { transition: opacity .1s; }
.pupil-in { transition: transform .15s ease; }
#cheekL, #cheekR { transition: opacity .3s; }

/* kvėpavimas + lengvas siūbavimas, kad Mimi niekada nestovėtų visai ramiai */
@keyframes breathe {
  0%, 100% { transform: rotate(-1.4deg) scale(1, 1); }
  25%      { transform: rotate(0deg) scale(1.012, 1.024); }
  50%      { transform: rotate(1.4deg) scale(1, 1); }
  75%      { transform: rotate(0deg) scale(1.012, 1.024); }
}
@keyframes tailIdle {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-7deg); }
}

/* ---------- efektai ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.p {
  position: absolute; left: 0; top: 0;
  translate: -50% -50%;
  line-height: 1;
  will-change: transform, opacity;
  font-weight: 800;
  color: #6a7a90;
}
.flyer {
  position: absolute; left: 0; top: 0;
  translate: -50% -50%;
  font-size: 54px; line-height: 1;
  will-change: transform;
}

#bubble {
  position: fixed; left: 0; top: 0; z-index: 4;
  padding: 10px 18px;
  background: #fff;
  border-radius: 22px;
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 800;
  color: #44506a;
  box-shadow: 0 6px 18px rgba(80, 50, 20, .18);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: scale(.4);
  transform-origin: 15% 100%;
  transition: opacity .15s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
#bubble::after {
  content: ""; position: absolute; left: 18px; bottom: -10px;
  border: 10px solid transparent; border-top-color: #fff; border-bottom: 0;
}
#bubble.show { opacity: 1; transform: scale(1); }

/* ---------- mygtukai ---------- */
#toolbar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; z-index: 5;
  width: max-content; max-width: calc(100vw - 16px);
  padding: 10px 14px;
  background: rgba(255, 255, 255, .5);
  border-radius: 46px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.tb {
  width: 72px; height: 72px; border-radius: 50%;
  border: none; padding: 0;
  background: #fff;
  box-shadow: 0 4px 0 #e2cfb5, 0 6px 14px rgba(80, 50, 20, .18);
  font-size: 38px; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .08s, box-shadow .08s, background .2s;
  font-family: inherit;
}
.tb:active { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 #e2cfb5, 0 3px 8px rgba(80, 50, 20, .18); }
.tb.mic-listen { background: #e6f8e4; animation: pulse 1.4s infinite; }
.tb.mic-record { background: #ffd9d9; animation: pulseRed .7s infinite; }
.tb.mic-play   { background: #fff2bf; }
@keyframes pulse    { 0% { box-shadow: 0 0 0 0 rgba(76,175,80,.55), 0 4px 0 #e2cfb5; } 100% { box-shadow: 0 0 0 18px rgba(76,175,80,0), 0 4px 0 #e2cfb5; } }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(229,57,53,.55), 0 4px 0 #e2cfb5; } 100% { box-shadow: 0 0 0 16px rgba(229,57,53,0), 0 4px 0 #e2cfb5; } }

@media (max-width: 420px) {
  .tb { width: 58px; height: 58px; font-size: 30px; }
  #toolbar { gap: 9px; padding: 9px 10px; }
}

/* ---------- starto ekranas ---------- */
#start {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 16px; text-align: center;
  background: radial-gradient(circle at 50% 38%, #fffaf2, #f3dcc0);
  transition: opacity .4s, visibility .4s;
}
#start.hide { opacity: 0; visibility: hidden; }
#start img {
  width: min(52vw, 40vh, 280px); aspect-ratio: 1; object-fit: cover;
  border-radius: 50%; border: 8px solid #fff;
  box-shadow: 0 10px 30px rgba(80, 50, 20, .25);
  animation: float 3s ease-in-out infinite;
}
#start h1 {
  margin: 0; font-size: clamp(60px, 13vw, 120px); line-height: 1;
  color: #56637a; letter-spacing: 3px;
  text-shadow: 0 4px 0 #fff, 0 8px 18px rgba(80, 50, 20, .2);
}
#start p { margin: 0; color: #7a6a58; font-size: clamp(16px, 2.6vw, 22px); max-width: 30em; }
#play {
  margin-top: 8px; padding: 18px 44px;
  font-size: clamp(26px, 5vw, 38px); font-weight: 800; font-family: inherit;
  color: #fff; background: #56637a; border: none; border-radius: 999px;
  box-shadow: 0 6px 0 #3c4659, 0 10px 24px rgba(40, 50, 70, .3);
  cursor: pointer;
}
#play:active { transform: translateY(4px); box-shadow: 0 2px 0 #3c4659; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }

/* muilo burbulai */
.soap {
  position: absolute; left: 0; top: 0;
  translate: -50% -50%;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.95) 0 7%, rgba(255,255,255,.18) 18%,
              rgba(170,220,255,.12) 55%, rgba(255,170,235,.35) 82%, rgba(255,255,255,.7) 100%);
  box-shadow: inset 0 0 10px rgba(255,255,255,.6), 0 0 6px rgba(150,200,255,.25);
  will-change: transform;
}

#start img.cut { object-fit: contain; background: #fff8ee; padding: 10px; }
#parents {
  position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px;
  font-size: 15px; color: #7a6a58; text-decoration: none;
  background: rgba(255,255,255,.7); padding: 8px 14px; border-radius: 999px;
}
