:root {
  --ink: #3d3a5c;
  --ink-soft: #6b6890;
  --mint: #bdeedc;
  --mint-deep: #5cc98f;
  --peach: #ffd6c2;
  --peach-deep: #ff9f7a;
  --sky: #cfe9ff;
  --sky-deep: #6fb6f2;
  --butter: #fff1b8;
  --butter-deep: #f7c948;
  --lav: #e3d9ff;
  --lav-deep: #a58cf0;
  --pink: #ffc9de;
  --pink-deep: #f48fb1;
  --card: #ffffff;
  --radius: 28px;
  --shadow: 0 8px 0 rgba(61, 58, 92, 0.1), 0 18px 40px rgba(61, 58, 92, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Baloo 2", "Nunito", "Comic Sans MS", system-ui, sans-serif;
  color: var(--ink);
  background: #eaf6ff center / cover no-repeat fixed;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.bg-meadow {
  background-image: url("../assets/img/bg-meadow.jpg");
}

body.bg-sky {
  background-image: url("../assets/img/bg-sky.jpg");
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  z-index: 20;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.topbar .title {
  flex: 1;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  text-shadow: 0 2px 0 #fff;
  pointer-events: none;
}

.icon-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
  font-weight: 800;
  font-size: 18px;
}

.icon-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

.icon-btn:active {
  transform: translateY(3px) scale(0.96);
}

.icon-btn svg {
  width: 32px;
  height: 32px;
  stroke: var(--ink);
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.voice-btn {
  width: auto;
  padding: 0 18px;
  border-radius: 32px;
  gap: 6px;
  display: flex;
  align-items: center;
}

.big-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  padding: 16px 34px;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  border-radius: 999px;
  background: var(--mint-deep);
  color: #fff;
  box-shadow: 0 8px 0 #3fa572, 0 16px 30px rgba(63, 165, 114, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-decoration: none;
}

.big-btn:hover {
  transform: translateY(-2px);
}

.big-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 #3fa572, 0 6px 16px rgba(63, 165, 114, 0.3);
}

.big-btn.alt {
  background: var(--sky-deep);
  box-shadow: 0 8px 0 #4a8fcc, 0 16px 30px rgba(74, 143, 204, 0.35);
}

.big-btn.alt:active {
  box-shadow: 0 2px 0 #4a8fcc, 0 6px 16px rgba(74, 143, 204, 0.3);
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(234, 246, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 40;
  padding: 20px;
}

.overlay[hidden] {
  display: none;
}

.panel {
  background: var(--card);
  border-radius: 40px;
  box-shadow: var(--shadow);
  padding: 30px 40px 40px;
  text-align: center;
  max-width: 640px;
  width: 100%;
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.panel h1,
.panel h2 {
  margin: 4px 0 10px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}

.panel p {
  margin: 0 0 22px;
  font-size: clamp(18px, 2.4vw, 24px);
  color: var(--ink-soft);
}

.panel .mascot {
  width: clamp(120px, 22vw, 190px);
  animation: bob 2.6s ease-in-out infinite;
}

.panel .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.mascot-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.mascot-box img {
  width: clamp(90px, 14vw, 150px);
  animation: bob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 10px rgba(61, 58, 92, 0.18));
}

.bubble {
  position: relative;
  background: var(--card);
  border-radius: 26px;
  padding: 12px 20px;
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 700;
  box-shadow: var(--shadow);
  margin-bottom: 60px;
  max-width: 280px;
}

.bubble::after {
  content: "";
  position: absolute;
  left: -12px;
  bottom: 18px;
  border: 12px solid transparent;
  border-right-color: var(--card);
  border-left: 0;
}

.bubble.say {
  animation: wiggle 0.5s ease;
}

.stars-count {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 18px 6px 8px;
  box-shadow: var(--shadow);
  font-size: 26px;
  font-weight: 800;
}

.stars-count img {
  width: 46px;
  height: 46px;
}

.stars-count.bump {
  animation: bump 0.5s ease;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.fly-star {
  position: fixed;
  width: 90px;
  height: 90px;
  z-index: 45;
  pointer-events: none;
  transition: transform 0.9s cubic-bezier(0.5, -0.3, 0.3, 1), opacity 0.9s ease;
}

.rotate-hint {
  display: none;
}

@keyframes pop-in {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-3deg);
  }
  75% {
    transform: rotate(3deg);
  }
}

@keyframes bump {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.25);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-12px);
  }
  40% {
    transform: translateX(10px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 5px 0 #e0a92a, 0 0 0 0 rgba(247, 201, 72, 0.7);
  }
  50% {
    box-shadow: 0 5px 0 #e0a92a, 0 0 0 14px rgba(247, 201, 72, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.tint-balloon {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--c, #f48fb1);
  -webkit-mask: url("../assets/img/balloon.png") center / contain no-repeat;
  mask: url("../assets/img/balloon.png") center / contain no-repeat;
}

.tint-balloon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/img/balloon.png") center / contain no-repeat;
  mix-blend-mode: multiply;
}

.icon-btn .ui-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  pointer-events: none;
}

.icon-btn.voice-btn .ui-icon {
  width: 36px;
  height: 36px;
}

.ui-icon.off {
  filter: grayscale(1);
  opacity: 0.45;
}

.panel .mascot.sticker {
  animation: none;
}

.panel .mascot.sticker-in {
  animation: sticker-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1), bob 2.6s ease-in-out 0.7s infinite;
}

@keyframes sticker-pop {
  0% {
    transform: scale(0.2) rotate(-30deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100dvh;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body.hub-page {
  height: auto;
  min-height: 100dvh;
}

button,
a,
img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.topbar {
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

@media (max-width: 900px) {
  .topbar {
    gap: 10px;
  }
  .icon-btn {
    width: 56px;
    height: 56px;
  }
  .icon-btn.voice-btn {
    padding: 0 14px;
    font-size: 16px;
  }
  .stars-count {
    font-size: 22px;
    padding: 4px 14px 4px 6px;
  }
  .stars-count img {
    width: 38px;
    height: 38px;
  }
}

@media (hover: none) {
  .card:hover,
  .group:hover,
  .icon-btn:hover,
  .big-btn:hover {
    transform: none;
  }
}
