@use 'styles/vars' as *;
@use 'styles/button';
@use 'styles/form';
@use 'styles/mixins' as *;
@use 'styles/settings';

@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300&family=Open+Sans&display=swap');

* {
  margin: 0;
  box-sizing: border-box;
  color: white;
  font-family: 'Open Sans', 'Segoe UI Emoji', sans-serif;

  &::selection {
    color: white;
    background-color: $accent;
  }
}

html {
  font-size: 0.85rem;
  @media (max-width: $breakpoint) {
    font-size: 0.6rem;
  }
}

img {
  user-select: none;
}

h1 {
  &,
  * {
    font-family: 'Comfortaa', sans-serif;
  }
  font-size: 6rem;
  text-align: center;
  padding-bottom: $medium-padding;
  @media (max-width: $height-breakpoint) {
    font-size: 4.5rem;
  }
  @media (max-height: $height-breakpoint) {
    display: none;
  }
}

.red {
  color: $accent;
  &::selection {
    color: $accent;
    background-color: white;
  }
}

html,
body,
canvas {
  height: 100%;
  width: 100%;
  background: black;
}

body {
  overflow: hidden;

  #spinner-container {
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    top: 0;

    @include background;
    #spinner {
      @include square(20vmax);
      @media (max-width: $breakpoint) {
        @include square(20vmax);
      }
    }
  }

  #landing-ui {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  #overlay {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;

    pointer-events: none;
    user-select: none;

    overflow: hidden;

    & > * {
      display: inline-block;
      position: absolute;
      top: 0;
      left: 0;
    }

    .player-tag {
      border-radius: 1000px;
      transition: transform 200ms;

      &.decla {
        color: $bright-decla;
        div:first-child {
          background-color: $bright-decla;
          &:before {
            background-color: $bright-decla;
            opacity: 0.3;
          }
        }
      }

      &.red {
        color: $bright-red;
        div:first-child {
          background-color: $bright-red;
          &:before {
            background-color: $bright-red;
            opacity: 0.4;
          }
        }
      }

      div:first-child {
        position: relative;
        height: 5px;
        border-radius: 1000px;

        &:before {
          content: '';
          position: absolute;
          height: 5px;
          width: 50px;
          box-sizing: border-box;
          border-radius: 1000px;
        }
      }

      div:not(:first-child) {
        letter-spacing: 2px;
        font-size: 0.8em;
      }
    }

    .ownership {
      font-size: 0;
      box-shadow: inset 0 0 3px 0px rgba(0, 0, 0, 0.2);

      @include square(50px);
      border-radius: 1000px;
      mask-image: url('../static/mask.svg');
    }

    .falling-point {
      font-size: 1.2em;
      &.decla {
        color: $bright-decla;
      }
      &.red {
        color: $bright-red;
      }
    }

    .other-player-arrow {
      @include square($large-icon);
      @media (max-width: $breakpoint) {
        @include square($small-icon);
      }

      mask-image: url('../static/chevron.svg');
      mask-size: contain;

      &.decla {
        background-color: $bright-decla;
      }
      &.red {
        background-color: $bright-red;
      }
    }

    .joystick {
      @include square($large-icon * 1.3);
      background-color: white;
      box-shadow: inset 0 0 8px 3px rgba(0, 0, 0, 0.33);
      opacity: 0.35;
      border-radius: 1000px;

      div {
        position: absolute;
        top: 50%;
        left: 50%;
        background-color: #444;
        box-shadow: 0 0 8px 3px rgba(0, 0, 0, 0.33);

        @include square($small-icon);
        border-radius: 1000px;
      }
    }

    .announcement {
      top: 25%;
      transform: translateX(calc(-50% + 50vw)) translateY(-50%);

      font-size: 3rem;
      @include background;
      z-index: 1000;
      padding: $medium-padding;
      border-radius: 16px;

      &:empty {
        display: none;
      }

      .decla {
        color: $bright-decla;
      }

      .red {
        color: $bright-red;
      }
    }

    .planet-progress {
      top: $small-padding;
      left: 50%;
      transform: translateX(-50%);
      width: 50%;
      display: flex;
      $height: 8px;
      height: $height;

      justify-content: space-between;
      box-shadow: inset 0 0 3px 0px rgba(0, 0, 0, 0.2);

      border-radius: 4px;
      z-index: 100;

      &::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translateX(-50%) translateY(-50%);
        background-color: #888;
        height: 24px;
        width: 4px;
        border-radius: 1000px;
      }

      &::after {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translateX(-50%) translateY(50%);

        @include square(24px);

        background-image: url('../static/flag.svg');
        background-size: contain;
      }

      div {
        height: $height;
        box-shadow: inset 0 0 3px 0px rgba(0, 0, 0, 0.2);
      }

      div:nth-child(1) {
        background: $bright-decla;
        border-radius: 100px 0 0 100px;
      }

      div:nth-child(2) {
        background: $bright-red;
        border-radius: 0 100px 100px 0;
      }
    }
  }

  #server-container {
    max-height: 30vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track,
    &::-webkit-scrollbar {
      background-color: transparent;
      width: 3px;
    }
    &::-webkit-scrollbar-thumb {
      background-color: $accent;
      border-radius: $border-radius;
    }

    transition: box-shadow $animation-time;
    &.scroll {
      box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.4),
        inset 0 8px 8px -8px rgba(0, 0, 0, 0.4);
      &.top {
        box-shadow: inset 0 -8px 8px -8px rgba(0, 0, 0, 0.4);
      }
      &.bottom {
        box-shadow: inset 0 8px 8px -8px rgba(0, 0, 0, 0.4);
      }
    }
  }

  .full-screen-controllers {
    position: absolute;
    bottom: 0;
    left: 0;

    box-sizing: content-box;

    user-select: none;
    cursor: pointer;

    padding: $medium-padding;
    @include square($large-icon);
    @media (max-width: $breakpoint) {
      @include square($small-icon);
      padding: $small-padding;
    }

    &:not(:first-child) {
      visibility: hidden;
    }
  }
}
