/* ============ Brick Blitz — game page ============ */
:root {
  --cream: #fff6ec;
  --ink: #33302e;
  --coral: #ff6b57;
  --sunny: #ffc93c;
  --mint: #3ecfb2;
  --sky: #7ec8ff;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--cream);
  font-family: "Nunito", -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.hud-top {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) calc(env(safe-area-inset-right, 0px) + 14px) 0 calc(env(safe-area-inset-left, 0px) + 14px);
}

.icon-btn {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s var(--spring), box-shadow 0.12s var(--spring);
  text-decoration: none;
}
.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}

#soundBtn .icon-off {
  display: none;
}
#soundBtn.muted .icon-on {
  display: none;
}
#soundBtn.muted .icon-off {
  display: block;
}

.hud-center {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  transform: translateX(-50%);
  text-align: center;
}

.round-wrap {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 11vw, 72px);
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 0 5px 0 var(--ink);
}
.round-wrap.bump {
  animation: bump 0.25s var(--spring);
}
.round-wrap small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink);
  -webkit-text-stroke: 0;
  text-shadow: none;
  margin-top: -2px;
}
@keyframes bump {
  40% {
    transform: scale(1.14);
  }
}

.best-tag {
  display: inline-block;
  margin-top: 6px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  box-shadow: 0 3px 0 var(--ink);
}

.balls-tag {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 18px;
  box-shadow: 0 4px 0 var(--ink);
}
.balls-tag.bump {
  animation: bump 0.25s var(--spring);
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 246, 236, 0.88);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  padding: 24px;
}
.hidden {
  display: none !important;
}

.ready-inner {
  text-align: center;
  animation: rise 0.5s var(--spring);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
}

.ready-logo {
  width: 76px;
  height: 76px;
  display: block;
  margin: 0 auto 14px;
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translateY(-7px) rotate(-2deg);
  }
}

.ready-inner h1 {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 10vw, 56px);
  line-height: 1.05;
}
.ready-inner p {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 600;
  color: rgba(51, 48, 46, 0.75);
  line-height: 1.55;
}

.tap-hint {
  margin: 26px auto 0;
  display: inline-block;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 17px;
  color: #fff;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 12px 30px;
  box-shadow: 0 6px 0 var(--ink);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    transform: scale(1.06);
  }
}

.over-card {
  width: min(88vw, 360px);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 28px 24px 24px;
  text-align: center;
  animation: rise 0.4s var(--spring);
}
.over-card h2 {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 26px;
}
.over-score {
  margin-top: 8px;
}
.over-score span {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  color: var(--coral);
}
.over-score small {
  display: block;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(51, 48, 46, 0.6);
  margin-top: 2px;
}

.new-best {
  display: inline-block;
  margin-top: 10px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--sunny);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 14px;
  box-shadow: 0 3px 0 var(--ink);
  animation: wiggle 0.8s ease-in-out infinite;
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(2deg) scale(1.04);
  }
}

.over-best {
  margin-top: 10px;
  font-weight: 700;
  font-size: 14px;
  color: rgba(51, 48, 46, 0.65);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 13px 24px;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--spring), box-shadow 0.12s var(--spring);
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn-primary {
  background: var(--coral);
  color: #fff;
}
