I have the following vb.net program: Form1.vb, HighScoresForm.vb and MapForm.vb  Can you add 'a time bonus for finishing quickly (extra points when round ends).'

Form1.vb:

Imports System.Drawing
Imports System.Media
Imports System.IO
Imports System.Diagnostics

Public Class Form1
    Private rand As New Random()
    Private treasures As New List(Of Point)
    Private foundTreasures As New List(Of Point)
    Private Const treasureRadius As Integer = 10
    Private Const hitRange As Integer = 20
    Private treasureCount As Integer = 5

    Private mapWindow As MapForm
    Private digSound As SoundPlayer
    Private foundSound As SoundPlayer

    Private gameTimer As New Timer()
    Private elapsedSeconds As Integer = 0
    Private score As Integer = 0

    Private lblTime As Label
    Private lblScore As Label
    Private lblLeft As Label

    Private highScoreFile As String = "highscores.txt"

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Text = "Treasure Hunt!"
        Me.DoubleBuffered = True
        Me.BackColor = Color.SandyBrown
        Me.Size = New Size(660, 440)

        ' Buttons
        Dim btnBury As New Button() With {.Text = "Bury Treasure", .Location = New Point(10, 10)}
        AddHandler btnBury.Click, AddressOf BuryTreasure
        Controls.Add(btnBury)

        Dim btnReset As New Button() With {.Text = "Reset", .Location = New Point(120, 10)}
        AddHandler btnReset.Click, AddressOf ResetGame
        Controls.Add(btnReset)

        Dim btnMap As New Button() With {.Text = "Show Map", .Location = New Point(230, 10)}
        AddHandler btnMap.Click, AddressOf ShowMap
        Controls.Add(btnMap)

        Dim btnScores As New Button() With {.Text = "View High Scores", .Location = New Point(340, 10)}
        AddHandler btnScores.Click, AddressOf ShowHighScores
        Controls.Add(btnScores)

        ' Labels
        lblTime = New Label() With {.Text = "Time: 0s", .Location = New Point(500, 14), .AutoSize = True, .Font = New Font("Segoe UI", 9, FontStyle.Bold)}
        Controls.Add(lblTime)

        lblScore = New Label() With {.Text = "Score: 0", .Location = New Point(580, 14), .AutoSize = True, .Font = New Font("Segoe UI", 9, FontStyle.Bold)}
        Controls.Add(lblScore)

        lblLeft = New Label() With {.Text = "Treasures: 0", .Location = New Point(580, 30), .AutoSize = True, .Font = New Font("Segoe UI", 9, FontStyle.Bold)}
        Controls.Add(lblLeft)

        gameTimer.Interval = 1000
        AddHandler gameTimer.Tick, AddressOf GameTimer_Tick

        LoadSounds()
    End Sub

    Private Sub LoadSounds()
        Try
            If File.Exists("dig.wav") Then
                digSound = New SoundPlayer("dig.wav")
                digSound.Load()
            End If
            If File.Exists("found.wav") Then
                foundSound = New SoundPlayer("found.wav")
                foundSound.Load()
            End If
        Catch
            MessageBox.Show("Sound loading failed.")
        End Try
    End Sub

    Private Sub PlayDigSound()
        Try
            If digSound IsNot Nothing Then digSound.Play() Else SystemSounds.Beep.Play()
        Catch
        End Try
    End Sub

    Private Sub PlayFoundSound()
        Try
            If foundSound IsNot Nothing Then foundSound.Play() Else SystemSounds.Hand.Play()
        Catch
        End Try
    End Sub

    Private Sub BuryTreasure(sender As Object, e As EventArgs)
        treasures.Clear()
        foundTreasures.Clear()
        score = 0
        elapsedSeconds = 0
        UpdateScoreDisplay()
        UpdateTimeDisplay()

        Dim areaWidth As Integer = Me.ClientSize.Width
        Dim areaHeight As Integer = Me.ClientSize.Height - 50
        For i As Integer = 1 To treasureCount
            treasures.Add(New Point(rand.Next(50, areaWidth - 50), rand.Next(60, areaHeight)))
        Next

        PlayFoundSound()
        MessageBox.Show("Treasures buried! Timer started. Now dig and find them!", "Ready")

        UpdateMap()
        UpdateLeftDisplay()
        Me.Invalidate()
        gameTimer.Start()
    End Sub

    Private Sub ResetGame(sender As Object, e As EventArgs)
        treasures.Clear()
        foundTreasures.Clear()
        score = 0
        elapsedSeconds = 0
        gameTimer.Stop()
        UpdateScoreDisplay()
        UpdateTimeDisplay()
        UpdateLeftDisplay()
        Me.Invalidate()
        UpdateMap()
    End Sub

    Private Sub ShowMap(sender As Object, e As EventArgs)
        If mapWindow Is Nothing OrElse mapWindow.IsDisposed Then
            mapWindow = New MapForm()
        End If
        UpdateMap()
        mapWindow.Show()
        mapWindow.BringToFront()
    End Sub

    Private Sub UpdateMap()
        If mapWindow IsNot Nothing AndAlso Not mapWindow.IsDisposed Then
            mapWindow.UpdateMap(treasures.Except(foundTreasures).ToList())
        End If
    End Sub

    Private Sub GameTimer_Tick(sender As Object, e As EventArgs)
        elapsedSeconds += 1
        UpdateTimeDisplay()
    End Sub

    Private Sub UpdateTimeDisplay()
        lblTime.Text = $"Time: {elapsedSeconds}s"
    End Sub

    Private Sub UpdateScoreDisplay()
        lblScore.Text = $"Score: {score}"
    End Sub

    Private Sub UpdateLeftDisplay()
        lblLeft.Text = $"Treasures: {treasures.Count - foundTreasures.Count}"
    End Sub

    Private Sub Form1_MouseClick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
        If treasures.Count = 0 Then
            PlayDigSound()
            Return
        End If

        PlayDigSound()

        For Each t In treasures
            Dim dx As Integer = e.X - t.X
            Dim dy As Integer = e.Y - t.Y
            Dim distance As Double = Math.Sqrt(dx * dx + dy * dy)
            If distance < hitRange AndAlso Not foundTreasures.Contains(t) Then
                foundTreasures.Add(t)

                Dim basePoints As Integer = 1000
                Dim decay As Integer = 10
                Dim pts As Integer = basePoints - (elapsedSeconds * decay)
                If pts < 50 Then pts = 50
                score += pts

                PlayFoundSound()
                MessageBox.Show($"You found a treasure! +{pts} points", "Success")

                Me.Invalidate()
                UpdateMap()
                UpdateScoreDisplay()
                UpdateLeftDisplay()

                If foundTreasures.Count >= treasures.Count Then
                    EndGame()
                    ''gameTimer.Stop()
                    ''MessageBox.Show($"All treasures found! Time: {elapsedSeconds}s | Score: {score}", "Complete")
                    ''SaveHighScore()
                End If
                Exit For
            End If
        Next
    End Sub

    Private Sub SaveHighScore()
        Dim name As String = InputBox("Enter your name for the leaderboard:", "High Score")
        If String.IsNullOrWhiteSpace(name) Then name = "Anonymous"
        Try
            File.AppendAllLines(highScoreFile, {$"{name},{score},{elapsedSeconds},{DateTime.Now}"})
        Catch
            MessageBox.Show("Error saving score.")
        End Try
    End Sub

    Private Sub EndGame()
        gameTimer.Stop()

        Dim playerName As String = InputBox("You found all the treasures! Enter your name:", "Game Over", "Player")
        If String.IsNullOrWhiteSpace(playerName) Then playerName = "Anonymous"

        Dim score As Integer = Math.Max(1000 - elapsedSeconds * 10, 0)
        Dim recordLine As String = $"{playerName},{score},{elapsedSeconds},{DateTime.Now}"

        Try
            File.AppendAllText(highScoreFile, recordLine & Environment.NewLine)
        Catch ex As Exception
            MessageBox.Show("Could not save high score: " & ex.Message)
        End Try

        ' --- Compute player's rank for display ---
        Dim rank As Integer = 0
        Dim totalPlayers As Integer = 0

        Try
            If File.Exists(highScoreFile) Then
                Dim scores = File.ReadAllLines(highScoreFile)
                Dim scoreList = New List(Of (Player As String, Score As Integer))

                For Each line In scores
                    Dim parts = line.Split(","c)
                    If parts.Length >= 2 Then
                        Dim s As Integer
                        If Integer.TryParse(parts(1), s) Then
                            scoreList.Add((parts(0), s))
                        End If
                    End If
                Next

                totalPlayers = scoreList.Count
                Dim ordered = scoreList.OrderByDescending(Function(x) x.Score).ToList()
                For i As Integer = 0 To ordered.Count - 1
                    If String.Equals(ordered(i).Player, playerName, StringComparison.OrdinalIgnoreCase) AndAlso ordered(i).Score = score Then
                        rank = i + 1
                        Exit For
                    End If
                Next
            End If
        Catch
            rank = 0
        End Try

        ' ✅ Auto-open leaderboard and highlight this player
        Dim hs As New HighScoresForm(highScoreFile, playerName, score)
        hs.ShowDialog()

        ' --- Show detailed congratulations message ---
        Dim msg As String = $"Your Score: {score}" & vbCrLf &
                        $"Time: {elapsedSeconds} seconds"
        If rank > 0 Then
            msg &= vbCrLf & $"🏅 You ranked #{rank} out of {totalPlayers}!"
        End If

        MessageBox.Show(msg, "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Information)

        ResetGame(Nothing, Nothing)
    End Sub

    Private Sub ShowHighScores(sender As Object, e As EventArgs)
        Dim hs As New HighScoresForm(highScoreFile)
        hs.ShowDialog()
    End Sub

    Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
        Dim g As Graphics = e.Graphics
        For Each t In foundTreasures
            g.FillEllipse(Brushes.Gold, t.X - treasureRadius, t.Y - treasureRadius, treasureRadius * 2, treasureRadius * 2)
            g.DrawEllipse(Pens.Black, t.X - treasureRadius, t.Y - treasureRadius, treasureRadius * 2, treasureRadius * 2)
        Next
        g.DrawRectangle(Pens.Brown, 0, 50, Me.ClientSize.Width - 1, Me.ClientSize.Height - 60)
    End Sub
End Class

-------------------------

HighScoresForm.vb:

Imports System.IO
Imports System.Drawing

Public Class HighScoresForm
    Private filePath As String
    Private dgv As DataGridView
    Private highlightPlayer As String
    Private highlightScore As Integer
    Private lblRank As Label
    Private glowTimer As Timer
    Private glowStep As Integer = 0
    Private glowIncreasing As Boolean = True
    Private glowTimeElapsed As Integer = 0

    Public Sub New(path As String, Optional player As String = "", Optional score As Integer = -1)
        InitializeComponent()
        filePath = path
        highlightPlayer = player
        highlightScore = score

        ' --- Form settings ---
        Me.Text = "🏆 High Scores"
        Me.Size = New Size(480, 400)
        Me.StartPosition = FormStartPosition.CenterParent
        Me.BackColor = Color.Bisque
        Me.FormBorderStyle = FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False

        ' --- Rank label setup ---
        lblRank = New Label() With {
            .Dock = DockStyle.Top,
            .Height = 35,
            .TextAlign = ContentAlignment.MiddleCenter,
            .Font = New Font("Segoe UI", 11, FontStyle.Bold),
            .ForeColor = Color.DarkSlateBlue,
            .Visible = False
        }
        Controls.Add(lblRank)

        ' --- Glow animation timer ---
        glowTimer = New Timer() With {.Interval = 80}
        AddHandler glowTimer.Tick, AddressOf AnimateGlow

        ' --- DataGridView setup ---
        dgv = New DataGridView() With {
            .Dock = DockStyle.Top,
            .Height = 270,
            .ReadOnly = True,
            .AllowUserToAddRows = False,
            .AllowUserToDeleteRows = False,
            .AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
            .BackgroundColor = Color.White
        }

        dgv.Columns.Add("Rank", "#")
        dgv.Columns.Add("Player", "Player")
        dgv.Columns.Add("Score", "Score")
        dgv.Columns.Add("Time", "Time (s)")
        dgv.Columns.Add("Date", "Date")
        Controls.Add(dgv)

        ' --- Buttons panel ---
        Dim panel As New FlowLayoutPanel() With {
            .Dock = DockStyle.Bottom,
            .Height = 55,
            .FlowDirection = FlowDirection.RightToLeft,
            .Padding = New Padding(10)
        }

        Dim btnClose As New Button() With {.Text = "Close", .Width = 80}
        AddHandler btnClose.Click, Sub() Me.Close()

        Dim btnClear As New Button() With {.Text = "Clear Scores", .Width = 100}
        AddHandler btnClear.Click, AddressOf ClearScores

        panel.Controls.Add(btnClose)
        panel.Controls.Add(btnClear)
        Controls.Add(panel)

        ' --- Load scores when form opens ---
        LoadScores()
    End Sub

    Private Sub LoadScores()
        dgv.Rows.Clear()

        If Not File.Exists(filePath) Then
            MessageBox.Show("No high scores yet!", "Leaderboard")
            Return
        End If

        Dim scores = File.ReadAllLines(filePath)
        Dim scoreList = New List(Of (Player As String, Score As Integer, Time As Integer, DateStr As String))

        For Each line In scores
            Dim parts = line.Split(","c)
            If parts.Length >= 4 Then
                Dim s As Integer
                Dim t As Integer
                Integer.TryParse(parts(1), s)
                Integer.TryParse(parts(2), t)
                scoreList.Add((parts(0), s, t, parts(3)))
            End If
        Next

        Dim top = scoreList.OrderByDescending(Function(x) x.Score).ToList()
        Dim playerRank As Integer = 0
        Dim totalPlayers As Integer = top.Count

        For i As Integer = 0 To Math.Min(top.Count - 1, 19)
            Dim rank As Integer = i + 1

            ' Add medal icons for top 3
            Dim displayName As String = top(i).Player
            Select Case i
                Case 0 : displayName = "🥇 " & displayName
                Case 1 : displayName = "🥈 " & displayName
                Case 2 : displayName = "🥉 " & displayName
            End Select

            Dim idx = dgv.Rows.Add(rank.ToString(), displayName, top(i).Score, top(i).Time, top(i).DateStr)
            Dim row = dgv.Rows(idx)

            ' Row colors
            Select Case i
                Case 0 : row.DefaultCellStyle.BackColor = Color.Gold
                Case 1 : row.DefaultCellStyle.BackColor = Color.Silver
                Case 2 : row.DefaultCellStyle.BackColor = Color.FromArgb(205, 127, 50) ' Bronze
                Case Else : row.DefaultCellStyle.BackColor = Color.Beige
            End Select

            ' Highlight current player
            If String.Equals(top(i).Player, highlightPlayer, StringComparison.OrdinalIgnoreCase) AndAlso top(i).Score = highlightScore Then
                row.DefaultCellStyle.BackColor = Color.LightGreen
                row.DefaultCellStyle.Font = New Font(dgv.Font, FontStyle.Bold)
                dgv.FirstDisplayedScrollingRowIndex = idx
                playerRank = rank
            End If
        Next

        ' --- Show animated rank label if applicable ---
        If playerRank > 0 Then
            lblRank.Text = $"🏅 You ranked #{playerRank} out of {totalPlayers} players!"
            lblRank.Visible = True
            glowStep = 0
            glowIncreasing = True
            glowTimeElapsed = 0
            glowTimer.Start()
        End If
    End Sub

    ' --- Label glow animation ---
    Private Sub AnimateGlow(sender As Object, e As EventArgs)
        ' Increase elapsed time (80ms per tick)
        glowTimeElapsed += glowTimer.Interval

        ' Stop after 5 seconds (5000 ms)
        If glowTimeElapsed >= 5000 Then
            glowTimer.Stop()
            lblRank.ForeColor = Color.DarkSlateBlue ' Return to solid color
            Exit Sub
        End If

        ' Pulse effect
        If glowIncreasing Then
            glowStep += 15
            If glowStep >= 255 Then
                glowStep = 255
                glowIncreasing = False
            End If
        Else
            glowStep -= 15
            If glowStep <= 100 Then
                glowStep = 100
                glowIncreasing = True
            End If
        End If

        lblRank.ForeColor = Color.FromArgb(glowStep, 72, 61, 139) ' Animate color intensity
    End Sub

    Private Sub ClearScores(sender As Object, e As EventArgs)
        If Not File.Exists(filePath) Then
            MessageBox.Show("No scores to clear.", "Clear Scores")
            Return
        End If

        Dim confirm = MessageBox.Show("Are you sure you want to clear all high scores?", "Confirm Clear", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
        If confirm = DialogResult.Yes Then
            Try
                File.Delete(filePath)
                dgv.Rows.Clear()
                lblRank.Visible = False
                glowTimer.Stop()
                MessageBox.Show("High scores cleared!", "Done")
            Catch ex As Exception
                MessageBox.Show("Failed to clear scores: " & ex.Message)
            End Try
        End If
    End Sub
End Class

-------------------------

MapForm.vb:

Imports System.Drawing

Public Class MapForm
    Private treasures As New List(Of Point)

    Public Sub New()
        InitializeComponent()
        Me.Text = "Treasure Map"
        Me.Size = New Size(300, 250)
        Me.BackColor = Color.Beige
        Me.DoubleBuffered = True
    End Sub

    Public Sub UpdateMap(newTreasures As List(Of Point))
        treasures = New List(Of Point)(newTreasures)
        Me.Invalidate()
    End Sub

    Protected Overrides Sub OnPaint(e As PaintEventArgs)
        MyBase.OnPaint(e)
        Dim g As Graphics = e.Graphics

        If treasures.Count = 0 Then
            g.DrawString("No treasures buried or all found!", Me.Font, Brushes.Black, 20, 100)
        Else
            For Each t In treasures
                Dim scaledX As Integer = CInt(t.X / 2.5)
                Dim scaledY As Integer = CInt((t.Y - 50) / 2.5)
                g.FillEllipse(Brushes.Gold, scaledX - 5, scaledY - 5, 10, 10)
                g.DrawEllipse(Pens.Brown, scaledX - 5, scaledY - 5, 10, 10)
            Next
        End If
    End Sub
End Class

