:root {
  --sky-top: #8fd3ff;
  --sky-bot: #cdeeff;
  --ink: #143a5a;
  --accent: #ff8a3d;
  --accent-2: #ffd23f;
  --panel: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #6cc0ff;
  font-family: "Fredoka", "Baloo 2", system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.back-link {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 50;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(20, 58, 90, 0.45);
  backdrop-filter: blur(4px);
  transition: background 0.2s ease;
}
.back-link:hover { background: rgba(20, 58, 90, 0.7); }

#stage {
  position: absolute;
  inset: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

#game {
  display: block;
  background: linear-gradient(var(--sky-top), var(--sky-bot));
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(10, 40, 70, 0.35);
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
}

.overlay {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  color: var(--ink);
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(143, 211, 255, 0.35));
  backdrop-filter: blur(2px);
}
.overlay.hidden { display: none; }

.title {
  font-family: "Baloo 2", "Fredoka", sans-serif;
  font-weight: 800;
  font-size: clamp(42px, 11vw, 72px);
  margin: 0;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 4px 0 var(--accent), 0 8px 18px rgba(20, 58, 90, 0.4);
}

.tagline {
  margin: 0;
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 6px rgba(20, 58, 90, 0.45);
}

.over-title {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(34px, 9vw, 56px);
  margin: 0;
  color: #fff;
  text-shadow: 0 3px 0 var(--accent), 0 6px 14px rgba(20, 58, 90, 0.4);
}

.score-line {
  margin: 0;
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 700;
  color: var(--ink);
}
.score-line span { color: var(--accent); }

.best {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.howto {
  margin: 6px 0 0;
  max-width: 320px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(20, 58, 90, 0.8);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  padding: 14px 44px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 0 #d9661f, 0 12px 22px rgba(20, 58, 90, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #d9661f, 0 6px 12px rgba(20, 58, 90, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
