/* Boopie Boopie game styles. Self-contained: the reset is scoped to #bb-root,
   and the game sizes itself to the viewport, so no framework CSS is needed. */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

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

:root {
  --ink: #3a2d4a;
  --card: rgba(255, 255, 255, 0.78);
  --accent: #ff7eb3;
  --accent2: #7ee0c8;
}
/* Reset wrapped in :where() so it has zero specificity — component rules like
   .btn/.card/.panel keep their intended padding instead of being clobbered by
   an id-scoped universal selector. */
:where(#bb-root *) {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
#bb-root {
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
}
#stage {
  position: relative;
  height: 100dvh;
  width: 100vw;
  transition: background 1.2s ease;
  background: linear-gradient(180deg, #bfe9ff 0%, #d9f7e6 55%, #c8f0c0 100%);
  overflow: hidden;
  user-select: none;
  cursor: crosshair;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.5;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite;
}
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  pointer-events: none;
}
.panel {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(80, 50, 90, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.6);
}
#score {
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
}
#scoreLabel,
#comboLabel {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
  font-weight: 600;
}
#combo {
  text-align: right;
  font-weight: 700;
  font-size: 22px;
  transition: transform 0.12s;
}
#tierName {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.55;
}
#controls {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  /* Above the start/over overlay (z-index 50) so the mute toggles stay bright
     and tappable while the menu card is up. */
  z-index: 60;
  display: flex;
  gap: 10px;
}
.ctl {
  position: relative;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(80, 50, 90, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
}
.ctl svg {
  width: 100%;
  height: 100%;
}
.ctl .slash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
  box-shadow: 0 0 0 2px var(--card);
  opacity: 0;
  transition: opacity 0.1s;
}
.ctl.off {
  opacity: 0.55;
}
.ctl.off .slash {
  opacity: 1;
}
#timerWrap {
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(70%, 420px);
  height: 12px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(80, 50, 90, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.6);
  overflow: hidden;
}
#timerBar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7ee0c8, #ffd166, #ff7eb3);
  transition: width 0.1s linear;
}
#timerBar.add {
  transition: width 0.25s ease;
  box-shadow: 0 0 14px rgba(126, 224, 200, 0.9);
}
#note {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-size: 12px;
  opacity: 0.55;
  text-align: center;
  width: 90%;
}

.pet {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  will-change: transform;
  width: 110px;
  height: 110px;
  transition:
    left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pet .body {
  position: relative;
  width: 100%;
  height: 100%;
  animation: hop 0.9s ease-in-out infinite;
  transform-origin: 50% 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 74px;
  line-height: 1;
}
.pet .body img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 8px rgba(40, 20, 50, 0.25));
}
.pet .nose {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.pet.popped .body {
  animation: squish 0.35s ease forwards;
}
.pet.special .body {
  filter: drop-shadow(0 0 8px rgba(255, 194, 61, 0.95))
    drop-shadow(0 0 3px rgba(255, 140, 40, 0.9));
}

.float {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  font-weight: 700;
  font-size: 22px;
  animation: floatUp 0.8s ease-out forwards;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

#overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  background: rgba(40, 25, 55, 0.28);
  backdrop-filter: blur(3px);
}
#overlay.hidden {
  display: none;
}
.hidden {
  display: none !important;
}
.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  border-radius: 30px;
  padding: 34px 30px;
  max-width: 330px;
  box-shadow: 0 20px 50px rgba(60, 35, 75, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.7);
}
.card h1 {
  font-size: 40px;
  font-weight: 700;
}
.card h1 .a {
  color: var(--accent);
}
.card h1 .b {
  color: var(--accent2);
}
.card p {
  margin: 12px 0 20px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  opacity: 0.8;
}
.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ff9d6e);
  padding: 14px 34px;
  border-radius: 999px;
  box-shadow: 0 8px 0 rgba(200, 80, 120, 0.4);
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}
.btn:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 rgba(200, 80, 120, 0.4);
}
.btn.ghost {
  background: rgba(120, 100, 150, 0.35);
  box-shadow: 0 8px 0 rgba(90, 70, 120, 0.3);
  margin-top: 10px;
  font-size: 15px;
  padding: 11px 26px;
}
.btn.ghost:active {
  box-shadow: 0 3px 0 rgba(90, 70, 120, 0.3);
}
.navRow {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}
.btn.nav {
  display: inline-block;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 18px;
  margin: 0;
}
#initWrap {
  margin: 6px 0 16px;
}
.initLbl {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
  font-weight: 600;
  margin-bottom: 6px;
}
#initials {
  font-family: inherit;
  font-weight: 700;
  font-size: 38px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 14px;
  text-indent: 14px;
  width: 160px;
  padding: 6px 0;
  color: var(--ink);
  border: none;
  border-bottom: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  outline: none;
}
.initWho {
  font-size: 12px;
  opacity: 0.6;
  font-weight: 500;
  margin-top: 6px;
  min-height: 14px;
}
.big {
  font-size: 30px;
  font-weight: 700;
  margin: 6px 0;
}
.best {
  font-size: 14px;
  opacity: 0.7;
  font-weight: 500;
}

@keyframes hop {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  20% {
    transform: translateY(2px) scale(1.08, 0.92);
  }
  50% {
    transform: translateY(-14px) scale(0.96, 1.06);
  }
}
@keyframes squish {
  0% {
    transform: scale(1.25, 0.7);
  }
  40% {
    transform: scale(0.7, 1.3);
  }
  100% {
    transform: scale(0);
  }
}
@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  20% {
    transform: translateY(-8px) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translateY(-54px) scale(1);
    opacity: 0;
  }
}
@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, -24px);
  }
}
