:root {
  --ink: #12344f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1622;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;        /* kill scroll / pinch-zoom during play */
  cursor: pointer;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Mute button */
.ks-mute {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 40;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .32);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* "Tap to score!" hint */
.ks-hint {
  position: absolute;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(0, 0, 0, .34);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: clamp(15px, 4.4vw, 22px);
  pointer-events: none;
  white-space: nowrap;
  animation: ksPulse 1s ease-in-out infinite;
}
.ks-hint[hidden] { display: none; }

@keyframes ksPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.08); }
}

/* Overlay screens */
.ks-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(160deg, rgba(8, 20, 34, .55), rgba(8, 20, 34, .8));
}
.ks-screen[hidden] { display: none; }

.ks-card {
  width: 100%;
  max-width: 440px;
  padding: 28px 26px;
  text-align: center;
  background: rgba(255, 255, 255, .94);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.ks-emojis { font-size: clamp(34px, 11vw, 56px); letter-spacing: 6px; }
.ks-card h1 { margin: .2em 0 .1em; font-size: clamp(30px, 9vw, 46px); color: var(--ink); }
.ks-card p { margin: .35em 0; font-size: clamp(15px, 4.4vw, 19px); color: #33485c; }
.ks-tiny { opacity: .7; font-size: clamp(12px, 3.4vw, 14px) !important; }

.ks-btn {
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #3a2400;
  font-weight: 800;
  font-size: clamp(20px, 6vw, 26px);
  padding: 14px 40px;
  background: linear-gradient(180deg, #ffd23f, #ff9f1c);
  box-shadow: 0 8px 0 #d97f12, 0 12px 22px rgba(0, 0, 0, .3);
  transition: transform .06s, box-shadow .06s;
}
.ks-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #d97f12, 0 8px 16px rgba(0, 0, 0, .3);
}

/* Goal celebration flash */
.ks-flash {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  pointer-events: none;
  text-align: center;
}
.ks-flash[hidden] { display: none; }
.ks-flash-emoji {
  font-size: clamp(80px, 30vw, 200px);
  line-height: 1;
  animation: ksPop .5s cubic-bezier(.2, 1.4, .5, 1) both;
}
.ks-flash-title {
  font-size: clamp(46px, 16vw, 120px);
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 3px #1b3a57;
  text-shadow: 0 6px 0 rgba(0, 0, 0, .25);
  animation: ksPop .4s both;
}
.ks-flash-sub {
  font-size: clamp(20px, 6.5vw, 38px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 8px rgba(0, 0, 0, .55);
}

@keyframes ksPop {
  0%   { transform: scale(.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
