<script>
  import {createEventDispatcher} from 'svelte';

  const dispatch = createEventDispatcher();

  function handleClear() {
    dispatch('clear');
  }
</script>

<div class="start-screen">
  <img src ='/assets/gameclear.png' alt="gameclear-img" class="gameclear-img">
  <h1>Game Clear</h1>
  <button on:click={handleClear}>Try Again</button>
</div>

<style>
  .start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-color: #210140;
    color: #18a48e;
    padding: 20px;
    align-items: center;
  }

  button {
    position: relative;
    display: block;
    margin: 0;
    padding: 4px;
    width: fit-content;
    cursor: pointer;
    font-size: 1.2rem;
    text-align: center;
    background-color: transparent;
    color: white;
    border: none;
    font-family: 'Aztec';
    justify-content: center;
    align-items: center;
  }

  button::before,
  button::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    background-image: url("/assets/obstacle.png");
    background-size: cover;
    opacity: 0;
    transform: translateY(-50%);
  }

  button::before {
    left: -30px;
  }

  button::after {
    right: -30px;
  }

  button:hover::before,
  button:hover::after {
    opacity: 1;
  }

  h1 {
    text-align: center;
    margin: 20px;
  }

  .gameclear-img {
    width: 300px;
    height: auto;
    align-self: center;
  }
</style>