* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120428;
  font-family: "Trebuchet MS", "Comic Sans MS", "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

.hidden { display: none !important; }

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 2px 8px #000, 0 0 12px #ff66cc;
  z-index: 5;
}

.hud-col { display: flex; flex-direction: column; gap: 4px; }
.hud-col.center { align-items: center; min-width: 220px; }
.hud-col.right { align-items: flex-end; }

#score { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
#high { font-size: 13px; opacity: 0.9; }
#level-label { font-size: 12px; font-weight: 800; color: #ffe066; }
#combo {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 800;
  color: #ffe066;
  animation: comboPulse 0.45s ease-in-out infinite alternate;
}

#meter-label { font-size: 14px; font-weight: 800; }
#meter-bar {
  width: min(280px, 42vw);
  height: 18px;
  border: 3px solid #fff;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  overflow: hidden;
}
#meter-fill {
  height: 100%;
  width: 0%;
  background: #ff8ad4;
}
#meter-pct { font-size: 12px; font-weight: 700; }

#lives { font-size: 22px; letter-spacing: 2px; }

#sound-btn {
  pointer-events: auto;
  margin-top: 6px;
  border: 2px solid #fff;
  background: rgba(20, 0, 40, 0.55);
  color: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

#controls-hint {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 6px #000;
  z-index: 5;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(40,0,80,0.35), rgba(10,0,30,0.55));
  z-index: 10;
}

.panel {
  max-width: 640px;
  width: min(92vw, 640px);
  text-align: center;
  color: #fff;
  padding: 28px 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(90,20,140,0.85), rgba(20,0,50,0.9));
  border: 4px solid #fff;
  box-shadow: 0 0 0 6px #ff66cc, 0 20px 50px rgba(0,0,0,0.45);
}

.rainbow-title {
  font-size: clamp(22px, 4.6vw, 38px);
  line-height: 1.15;
  background: linear-gradient(90deg, #ff5c8a, #ffd166, #7cff6b, #66d9ff, #c77dff, #ff5c8a);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleShine 3s linear infinite;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 #fff);
}

.emoji-row { font-size: 28px; margin: 10px 0; letter-spacing: 8px; }
.tagline { font-style: italic; margin: 8px 0 16px; opacity: 0.95; }

.howto {
  margin-top: 18px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  line-height: 1.55;
  font-size: 15px;
}

.big-btn {
  display: inline-block;
  margin: 6px 8px;
  padding: 14px 22px;
  font-size: 18px;
  font-weight: 900;
  border-radius: 999px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #ff8ad4, #ff4fa0);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 0 #9b1d62;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #9b1d62; }
.big-btn.ghost {
  background: transparent;
  box-shadow: none;
}

.tiny { margin-top: 10px; font-size: 12px; opacity: 0.8; }

#mobile-controls {
  position: absolute;
  bottom: 18px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 8;
  pointer-events: none;
}

.dpad, #swoop-btn { pointer-events: auto; }

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.dpad .mid { display: flex; gap: 36px; }
.dpad button, #swoop-btn {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  border: 3px solid #fff;
  background: rgba(40,0,80,0.55);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}
#swoop-btn {
  width: 110px;
  height: 70px;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffe066, #ff8ad4);
  color: #3b0040;
}

@keyframes titleShine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes comboPulse {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

@media (min-width: 901px) {
  #mobile-controls { display: none !important; }
}
@media (max-width: 900px) {
  #controls-hint { display: none !important; }
  #score { font-size: 16px; }
  #hud { padding: 8px; }
}
