
:root {
  --green:#63d96c;
  --green-dark:#2f9b44;
  --yellow:#ffd95a;
  --blue:#62d2ff;
  --pink:#ff6fb1;
  --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;
  overflow-x: hidden;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 15%, rgba(255,217,90,.9) 0 7%, transparent 8%),
    radial-gradient(circle at 88% 17%, rgba(98,210,255,.75) 0 9%, transparent 10%),
    linear-gradient(180deg, #9ee7ff 0%, #dcfaff 52%, #d9ffd8 100%);
}

.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 {
  width: min(1080px, calc(100% - 18px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 0 max(14px, env(safe-area-inset-bottom));
}

.top {
  padding-right: 112px;
  text-align: center;
  margin-bottom: 10px;
}

.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.2rem);
  line-height: .9;
  color: #1fa351;
  text-shadow: 3px 3px 0 #ffe45e, 6px 6px 0 rgba(98,210,255,.55);
}

.game-card {
  background: var(--panel);
  border: 5px solid #fff;
  border-radius: 30px;
  box-shadow: 0 16px 46px rgba(40,80,80,.16);
  padding: 8px;
  position: relative;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: min(62vh, 520px);
  min-height: 390px;
  border-radius: 22px;
  background: linear-gradient(#9ee7ff, #efffd5 60%, #8ee08d);
  touch-action: none;
}

.hud {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}

.hud-pill,
button {
  font-family: "Baloo 2", cursive;
  font-weight: 800;
}

.hud-pill {
  min-width: 96px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  border: 3px solid rgba(255,255,255,.96);
  text-align: center;
  box-shadow: 0 7px 18px rgba(50,90,80,.12);
}

.hud-pill span {
  display: block;
  font-size: .62rem;
  letter-spacing: 1.5px;
  color: #64748b;
}

.hud-pill strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  color: #263238;
}

.action-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #63d96c, #2fb6ff);
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(47,182,255,.28);
  cursor: pointer;
  touch-action: manipulation;
}

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

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

.message {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 5;
  min-width: 220px;
  padding: 15px 22px;
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  border: 4px solid #fff;
  box-shadow: 0 14px 44px rgba(40,80,80,.18);
  text-align: center;
  font-family: "Baloo 2";
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 900;
  color: #7957c8;
  opacity: 0;
  pointer-events: none;
}

.message.show { animation: msgPop 1.1s ease forwards; }

@keyframes msgPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  16%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.9); }
}

.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: 650px) {
  .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 {
    min-height: 440px;
    height: 64vh;
  }

  .hud {
    gap: 7px;
  }

  .hud-pill {
    min-width: 78px;
    padding: 7px 10px;
  }
}
