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

input,
button,
textarea,
select {
  font: inherit;
}

html {
  color-scheme: light dark;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: bold;
  text-transform: uppercase;
  background: var(--gradient-bg);
  color: var(--text);
}

canvas {
  image-rendering: pixelated;
  aspect-ratio: 10 / 9;
  width: 100%;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  row-gap: 2rem;
}

button {
  border: none;

  &:active {
    scale: 0.97;
  }
}

header {
  height: 2.75rem;
  display: flex;
  justify-content: end;
  align-items: center;
  pad: 0 1rem;
  background: transparent;

  #pauseButton {
    width: 1.25rem;
    height: 1.25rem;
    aspect-ratio: 1 / 1;
    z-index: 10;
    margin-right: 1rem;
    background: transparent;

    border-style: double;
    border-width: 0 0 0 1.25rem;
    border-color: transparent transparent transparent var(--text);
    cursor: pointer;
    transition: all 0.2s ease-out;

    &.paused {
      border-style: solid;
      border-width: 0.75rem 0 0.75rem 1.25rem;
    }
  }
}

#button-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  width: 100%;

  .d-pad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    place-content: center;
    background: var(--gradient-d-pad);
    border-radius: 50%;
    padding: 0.75rem;

    .d-pad-row {
      display: contents;

      .left,
      .right,
      .down,
      .up,
      .center,
      .empty {
        width: 4rem;
        height: 4rem;
        aspect-ratio: 1 / 1;
      }

      .left,
      .right {
        background: var(--gradient-l-r-pad);
        border: 4px solid var(--color-d-pad-border);
      }

      .left {
        border-radius: 10px 0 0 10px;
        border-right: none;
      }

      .right {
        border-radius: 0 10px 10px 0;
        border-left: none;
      }

      .center {
        background: var(--gradient-d-pad-center);
      }

      .down,
      .up {
        background: var(--gradient-t-b-pad);
        border: 4px solid var(--color-d-pad-border);
      }

      .down {
        border-radius: 0 0 10px 10px;
        border-top: none;
      }

      .up {
        border-radius: 10px 10px 0 0;
        border-bottom: none;
      }
    }
  }

  .ab-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    div {
      transform: rotate(-25deg);
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-around;

      span {
        padding: 10px;
        text-align: center;
        transform: translateX(24px);
      }
    }

    div:first-of-type {
      background: var(--gradient-ab-bg);
      border-radius: 40px;

      button {
        width: 68px;
        height: 68px;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
        background: var(--gradient-ab-button);
        box-shadow: 0 8px 8px -2px rgba(0, 0, 0, 0.8), inset 0 2px 6px -2px rgba(255, 255, 255, 0.8);
        margin: 8px;
        border-top: 4px solid var(--color-ab-button-border);
        transform: rotate(25deg);

        &:active {
          box-shadow: 0 6px 4px -2px rgba(0, 0, 0, 0.8), inset 0 2px 6px -2px rgba(255, 255, 255, 0.8);
          border-top-width: 2px;
          scale: 1;
        }
      }
    }
  }
}

.options-container {
  position: absolute;
  bottom: 1.25rem;
  gap: 1.25rem;
  width: 100%;
  height: fit-content;
  display: flex;
  justify-content: center;

  .option {
    transform: rotate(-25deg);
    display: flex;
    flex-direction: column-reverse;

    label {
      color: var(--text);
      text-align: center;
    }

    div {
      background: var(--gradient-ab-bg);
      padding: 0.25rem;
      border-radius: 1.25rem;

      select {
        background: var(--gradient-options-buttons);
        box-shadow: var(--shadow-options);
        color: transparent;
        border-radius: 1.25rem;
        width: 4.50rem;
        border: none;

        option {
          background: #121212;
          color: #fff;
        }

        &:active {
          box-shadow: var(--shadow-options-active);
        }
      }
    }
  }
}

@media only screen and (max-device-width: 1200px) and (orientation: landscape) {
  header {
    position: absolute;
    right: 0;
    background: transparent;
  }

  main {
    position: absolute;
    height: 100%;
    background: var(--gradient-bg);
  }

  canvas {
    width: auto;
    height: 100dvh;
  }

  #button-container {
    position: absolute;
    top: 1.25rem;
    padding: 0;
  }

  .left,
  .right,
  .down,
  .up,
  .center,
  .empty {
    width: 3.5rem;
    height: 3.5rem;
    aspect-ratio: 1 / 1;
  }

  .options-container {
    justify-content: end;
    padding: 0.75rem 0.50rem;
  }

  .ab-buttons {
    margin-top: 3rem;
    margin-right: 1.25rem;
  }
}

@media (width > 1200px) {
  header {
    position: absolute;
    right: 0;
    background: transparent;
  }

  main {
    height: 100dvh;
  }

  canvas {
    width: auto;
    height: 100%;
  }

  #button-container {
    display: none;
  }

  .options-container {
    position: absolute;
    justify-content: end;
    padding-right: 3rem;
  }
}