* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #8fd3ff;
  font-family: "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: linear-gradient(#8fd3ff 0%, #bfe8ff 30%, #a8e6a1 30.1%, #8fd88a 100%);
}
#bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
}
#bar .spacer { flex: 1; }
#lvl {
  min-width: 64px; height: 56px; padding: 0 16px; border-radius: 28px;
  background: #fff; color: #ff7a1a; font-size: 32px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.15);
}
.btn {
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: #fff; font-size: 30px; line-height: 1; padding: 0;
  box-shadow: 0 5px 0 rgba(0,0,0,.18); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn.off { opacity: .35; }
.btn.pulse, .big.pulse { animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); box-shadow: 0 0 0 8px rgba(255,210,61,.7); } }

#cv { flex: 1 1 auto; width: 100%; min-height: 0; display: block; touch-action: none; }

.overlay {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(40, 90, 140, .45);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  z-index: 10;
}
.overlay.show { display: flex; }
.panel {
  background: #fff; border-radius: 36px; padding: 28px 36px 34px;
  text-align: center; box-shadow: 0 10px 0 rgba(0,0,0,.15);
  animation: pop .35s cubic-bezier(.2,1.6,.4,1);
  max-width: 94vw;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.panel h1 { margin: 0 0 16px; font-size: 54px; color: #ff7a1a; }
.panel h2 { margin: 0 0 8px; font-size: 52px; color: #ff7a1a; }
.panel .stars { font-size: 56px; margin-bottom: 18px; }
.panel .row { display: flex; gap: 18px; justify-content: center; margin-top: 16px; }
.big {
  border: none; border-radius: 50%; cursor: pointer;
  width: 130px; height: 130px; font-size: 64px; line-height: 1;
  background: #3ccf6e; color: #fff; box-shadow: 0 8px 0 #1f9447;
}
.big:active { transform: translateY(5px); box-shadow: 0 3px 0 #1f9447; }
.big.small { width: 100px; height: 100px; font-size: 46px; background: #ffd23d; box-shadow: 0 7px 0 #d4a106; }
.big.small:active { box-shadow: 0 2px 0 #d4a106; }
.big.hidden { display: none; }

.panel.home { width: min(720px, 94vw); max-height: 92vh; display: flex; flex-direction: column; align-items: center; }
#map {
  margin-top: 24px; width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 14px;
  padding: 6px 4px 12px;
}
#map button {
  position: relative; aspect-ratio: 1; border: none; border-radius: 50%;
  font-size: 30px; font-weight: 900; color: #fff; cursor: pointer;
  background: #3d8bff; box-shadow: 0 5px 0 #1f5fc4;
  touch-action: manipulation;
}
#map button.done { background: #ffb81f; box-shadow: 0 5px 0 #d48a00; }
#map button.done::after { content: "⭐"; position: absolute; right: -6px; top: -8px; font-size: 24px; }
#map button.current { animation: pulse 1.2s ease-in-out infinite; }
#map button.locked { background: #c9d3de; box-shadow: 0 5px 0 #9aa7b5; color: #8090a0; font-size: 26px; }
