:root {
  scroll-behavior: smooth;
  font-size: 25px;
  font-family: cursive;
  transition: 500ms;
  color: #fff;
  background-color: #000;
}

body {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  font-weight: bold;
  text-align: center;
  transition: 500ms;
  margin: 0;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
}

img {
  max-width: 100%;
}

*::-webkit-scrollbar {
  display: none;
}

#header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 130px;
  position: relative;
}

#logo {
  width: 70px;
}

#x-score,
#o-score {
  position: relative;
  border-bottom: 5px solid transparent;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  color: #b2f0fe;
  min-width: 50px;

  &::before {
    content: attr(data-score);
    position: absolute;
    top: 25%;
  }

  & > img {
    width: 70px;
  }
}
#x-score {
  &::before {
    left: 4.5em;
  }
}
#o-score {
  &::before {
    right: 4.5em;
  }
}

#controls {
  display: flex;
  flex-flow: row nowrap;
  gap: 70px;

  & > * {
    outline: none;
    background-image: linear-gradient(
      90deg,
      #3b3bfe,
      #543aff,
      #3737f1,
      #2f2fcb
    );
    border-radius: 20px;
    padding-block: 7px 10px;
    font-size: 20px;
    width: 100px;
    opacity: 0.7;

    &:is(#reset, #clear) {
      display: none;
    }

    &:hover {
      cursor: pointer;
      opacity: 1;
    }

    &:focus-visible {
      box-shadow: 0 0 10px 5px #18baff;
      transition: 100ms;
      transform: translateY(-2px);
      opacity: 1;
    }

    &:active {
      box-shadow: 0 0 10px 5px #18baff;
      transition: 0s;
    }
  }
}

#start-msg {
  font-size: 70px;
  width: 500px;
  width: 100%;
  background-clip: text;
  color: transparent;
  cursor: default;
  background-image: linear-gradient(
    to right,
    #5c5cdb,
    #5858db,
    #5353d8,
    #4646da,
    #3131d9,
    #2020d9,
    #1515d6,
    #0909d6
  );
}

#end-game-msg {
  inline-size: 100px;
  block-size: 45px;
  font-size: 30px;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-image: linear-gradient(
    0.25turn,
    #18baff,
    #1388bb,
    #1394cb,
    #138abd,
    #127caa,
    #0f6990
  );
}

#play-box {
  position: relative;
  padding: 15px;
  border-radius: 30px;
  display: none;
  background-color: #001;

  & > #won-line {
    position: absolute;
    padding: 50px;
    width: 109%;
    top: -50px;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8dcde9;
    border: 3px solid;
    border-radius: 70px;
    z-index: 100;
    opacity: 0;
  }

  & > table {
    border-collapse: collapse;
    position: relative;
    --border: 5px solid #3737f1;

    & td {
      position: relative;
      padding: 60px;

      &:is(#_1, #_2) {
        border-inline-end: var(--border);
        border-block-end: var(--border);
      }
      &#_3 {
        border-block-end: var(--border);
      }
      &#_3 {
        border-block-end: var(--border);
      }
      &:is(#_4, #_5) {
        border-block-end: var(--border);
        border-inline-end: var(--border);
      }
      &#_6 {
        border-block-end: var(--border);
      }
      &:is(#_7, #_8) {
        border-inline-end: var(--border);
      }

      &:hover:empty {
        background-color: #77777732;
        transition: 100ms;
        cursor: pointer;
      }

      & > img {
        width: 100px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}

@media (max-width: 500px) {
  body {
    gap: 25px;
  }

  #logo {
    width: 50px;
  }

  #header {
    gap: 55px;
  }

  #controls {
    gap: 20px;

    & > * {
      padding-block: 5px 8px;
      font-size: 17px;
      width: 85px;
    }
  }

  #x-score,
  #o-score {
    font-size: 0.6rem;
    &::before {
      top: 27%;
    }

    & > img {
      width: 40px;
    }
  }
  #x-score {
    &::before {
      left: 4.25em;
    }
  }
  #o-score {
    &::before {
      right: 4.25em;
    }
  }

  #start-msg {
    font-size: 50px;
  }

  #play-box {
    & > #won-line {
      padding: 40px;
    }

    & > table td {
      padding: 50px;

      & > img {
        width: 70px;
      }
    }
  }
}

@media (max-width: 350px) {
  #logo {
    width: 30px;
  }

  #play-box {
    & > #won-line {
      padding: 30px;
    }

    & > table td {
      padding: 40px;

      & > img {
        width: 55px;
      }
    }
  }
}
