
:root {
  --pink:#ff6fb1;
  --yellow:#ffd95a;
  --blue:#62d2ff;
  --green:#63d96c;
  --purple:#7957c8;
  --text:#334155;
  --panel:rgba(255,255,255,.88);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 18%,rgba(255,217,90,.85) 0 7%,transparent 8%),
    radial-gradient(circle at 88% 16%,rgba(98,210,255,.75) 0 9%,transparent 10%),
    linear-gradient(135deg,#fff1f8 0%,#e8f8ff 48%,#fff8d8 100%);
  overflow-x: hidden;
}

.home-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 3px solid rgba(255,255,255,.96);
  color: var(--purple);
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 7px 24px rgba(50,90,80,.18);
  backdrop-filter: blur(10px);
  touch-action: manipulation;
}

.home-btn:active { transform: scale(.94); }

.app {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100% - 18px));
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
}

.top {
  padding-right: 112px;
  margin: 8px 0 14px;
  text-align: center;
}

.badge {
  display: inline-flex;
  padding: 7px 13px;
  border-radius: 999px;
  background: #fff7cc;
  border: 3px dashed #ffb703;
  color: #8a5a00;
  font-family: 'Baloo 2';
  font-weight: 800;
  font-size: .86rem;
  margin-bottom: 6px;
}

h1 {
  font-family: 'Baloo 2';
  font-size: clamp(2rem, 7vw, 4.1rem);
  line-height: .9;
  color: #ff5e9f;
  text-shadow: 3px 3px 0 #ffe45e, 6px 6px 0 rgba(98,210,255,.55);
}

.panel {
  background: var(--panel);
  border: 5px solid #fff;
  border-radius: 30px;
  box-shadow: 0 16px 46px rgba(40,80,80,.16);
  padding: 10px;
  margin-bottom: 12px;
}

.game-panel { padding: 8px; }

canvas {
  width: 100%;
  height: 420px;
  display: block;
  border-radius: 22px;
  background: linear-gradient(#9ee7ff,#ffe6f7);
  touch-action: none;
}

.controls {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

button {
  font-family: 'Baloo 2', cursive;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 28px;
  background: linear-gradient(135deg,#ff6fb1,#a78bfa);
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 8px 24px rgba(160,90,190,.25);
}

.primary-btn:active { transform: scale(.94); }

.score {
  font-family: 'Baloo 2';
  font-size: 1.25rem;
  font-weight: 800;
}

.hint {
  text-align: center;
  font-family: 'Baloo 2';
  font-weight: 800;
  color: #64748b;
  margin-top: 8px;
}

.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  font-size: 2rem;
  animation: spark .8s ease-out forwards;
}

@keyframes spark {
  from { transform: scale(.4) translateY(0); opacity: 1; }
  to { transform: scale(1.7) translateY(-55px); opacity: 0; }
}

@media (max-width:620px) {
  .top { padding-right: 66px; }

  .home-btn {
    width: 52px;
    height: 52px;
    min-height: 52px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .home-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
  }

  canvas { height: 390px; }
}
