@use "./mixins/display" as *;
@use "./mixins/effects" as *;
@import "./mixins/variables";

html,
body,
#__next {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
}

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

.App {
  text-align: center;
}

.App-logo {
  height: 40vmin;
  pointer-events: none;
}

.App-header {
  background-color: $theme;
  min-height: 100vh;
  font-size: calc(10px + 2vmin);
  color: white;
}

.App-link {
  color: #61dafb;
}

@keyframes App-logo-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

#gamefield {
  @include flex-col;
  align-items: center;
  justify-content: space-evenly;
  height: 100vh;
}

#game-frame {
  // $height: 864px;
  $height: 648px;
  $width: $height;
  height: $height;
  width: $width;
  max-height: 100vw;
  max-width: 100vw;
  display: grid;
  align-items: center;
  justify-items: center;
  grid-template-rows: 0.75fr repeat(12, 1fr) 0.75fr;
  grid-template-columns: 0.75fr repeat(12, 1fr) 0.75fr;

  > .label {
    grid-column: var(--x);
    grid-row: var(--y);
  }

  > .border-tile {
    box-sizing: border-box;
    border: 1px solid blue;
    height: 100%;
    width: 100%;
    grid-column: var(--x);
    grid-row: var(--y);

    &.edge {
      border: 1px solid gray;
    }

    @include gradient-edge;
  }

  > :not(.border) {
    box-sizing: border-box;
  }

  > span {
    vertical-align: center;
    user-select: none;
  }

  .ship {
    height: 100%;
    width: 100%;
    position: relative;
    @include flex-col;
    align-items: center;
    grid-row: var(--x);
    pointer-events: none;

    img {
      @include pixelart;
      position: absolute;
      // height: 90%;
      width: 90%;
      // object-fit: cover;
    }

    &.s2 {
      grid-column: 3 / 5;
    }

    &.s3 {
      grid-column: 3 / 6;
    }

    &.s4 {
      grid-column: 3 / 7;
    }
  }

  .hit-svg {
    // border: 2px solid blue;

    // height: 50px;
    // width: 50px;
    height: 100%;
    width: 100%;
    position: relative;
    @include flex;
    // align-items: center;
    // align-self: center;
    // justify-self: center;
    grid-column: var(--x);
    grid-row: var(--y);
    pointer-events: none;

    svg {
      position: absolute;
      height: 100%;
      width: 100%;

      box-sizing: border-box;
      padding: 25%;

      &.fa-burst {
        color: red;
      }
    }

    &.target {
      --color: red;
      color: var(--color);
      opacity: 0;

      &.preview {
        --color: orange;
      }
    }

    &.preview {
      opacity: 0;
      @include transition(0.5s);
    }

    &.radar {
      --color: limegreen;

      svg {
        opacity: 0;
      }

      &:not(.left):not(.right):not(.top):not(.bottom) {
        // border: 5px solid var(--color);
        grid-area: var(--y1) / var(--x1) / var(--y2) / var(--x2);

        svg {
          opacity: 1;
          padding: 12.5%;
        }
      }

      &.imply {
        box-shadow: 0 0 6px 6px #fff4;
      }

      &.preview {
        --color: lawngreen;
        background-color: #0001;
        // border: 5px dashed var(--color);
      }
    }

    &.show {
      opacity: 1;
    }

    &.imply > svg {
      opacity: 0;
    }

    &.left {
      border-left: 2px solid var(--color);
    }

    &.right {
      border-right: 2px solid var(--color);
    }

    &.top {
      border-top: 2px solid var(--color);
    }

    &.bottom {
      border-bottom: 2px solid var(--color);
    }

    &.imply {
      &.left {
        border-left: 2px dashed white;
      }

      &.right {
        border-right: 2px dashed white;
      }

      &.top {
        border-top: 2px dashed white;
      }

      &.bottom {
        border-bottom: 2px dashed white;
      }
    }

    &.left.top {
      border-top-left-radius: 8px;
    }

    &.right.top {
      border-top-right-radius: 8px;
    }

    &.left.bottom {
      border-bottom-left-radius: 8px;
    }

    &.right.bottom {
      border-bottom-right-radius: 8px;
    }
  }

  .r2 {
    border: 2px solid green;
  }

  .r3 {
    border: 2px solid yellowgreen;
  }

  .fog {
    width: inherit;
    pointer-events: none;

    &.left {
      grid-area: 1 / 1 / -1 / -1;
      align-self: flex-start;
      transform: rotate(180deg);
    }

    &.right {
      grid-area: 1 / 1 / -1 / -1;
      align-self: flex-end;
    }

    &.middle {
      grid-area: 4 / 4 / -4 / -4;
    }
  }
}

.event-bar {
  @include flex-row;
  padding: 1rem 3rem;
  background-color: #fff9;
  border-radius: 1rem;

  .item {
    @include flex-col;
    align-items: center;
    gap: 0.5rem;
    width: 128px;

    .container {
      img {
        width: 64px;
        padding: 8px;
        @include pixelart;
        background-color: white;
        border-radius: 1rem;
      }

      &.amount {
        position: relative;

        &::after {
          content: var(--amount);
          position: absolute;
          top: -6px;
          right: -6px;
          color: black;
          background-color: white;
          border: 1px solid black;
          border-radius: 8px;
          font-size: 16px;
          padding: 2px 8px;
        }
      }
    }

    span {
      color: black;
      font-size: 0.75em;
      font-weight: bold;
    }
  }
}
