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

html, body {
  height: 100%;
  overflow: hidden;
  background: #10141f;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
}

.game-wrap {
  position: relative;
  width: min(100vw, calc(100vh * 0.75));
  height: min(100vh, calc(100vw * 1.3333));
  max-width: 480px;
  max-height: 640px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* ---------- HUD skor ---------- */
.hud {
  position: absolute;
  top: 6%;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

.hud span {
  font-size: clamp(32px, 9vw, 56px);
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}

/* ---------- Overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 22, 0.45);
  backdrop-filter: blur(2px);
  padding: 20px;
}

.panel {
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.96);
  border: 3px solid #2f3b52;
  border-radius: 16px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.panel h1 {
  font-size: clamp(26px, 7vw, 36px);
  color: #2f3b52;
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.panel .hint {
  font-size: 14px;
  color: #5b6780;
  line-height: 1.6;
  margin-bottom: 20px;
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(#5cc45c, #37a037);
  border: none;
  border-bottom: 4px solid #2b802b;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.scores {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}

.scores > div {
  flex: 1;
  background: #eef2f8;
  border: 2px solid #d3dbe8;
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scores .label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7b879b;
}

.scores .value {
  font-size: 30px;
  font-weight: 800;
  color: #2f3b52;
}

.new-best {
  color: #e08a00;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 14px;
}

/* ---------- Tombol suara ---------- */
.sound-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.sound-btn:hover {
  background: rgba(0, 0, 0, 0.55);
}
